How do I remove PHP 7 Completely?
I have upgraded PHP old version to latest php7 but unable to start its services.
systemctl restart apache2.service
Job for apache2.service failed. See "systemctl status apache2.service" and "journalctl -xe" for details.Status Detail:
systemctl status apache2.service
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2)
Active: failed (Result: exit-code) since Mon 2016-01-04 13:58:17 IST; 5s ago Docs: man:systemd-sysv-generator(8) Process: 16666 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
Jan 04 13:58:17 GCT022 apache2[16666]: *
Jan 04 13:58:17 GCT022 apache2[16666]: * The apache2 configtest failed.
Jan 04 13:58:17 GCT022 apache2[16666]: Output of config test was:
Jan 04 13:58:17 GCT022 apache2[16666]: apache2: Syntax error on line 140 of /etc/apache2...
Jan 04 13:58:17 GCT022 apache2[16666]: Action 'configtest' failed.
Jan 04 13:58:17 GCT022 apache2[16666]: The Apache error log may have more information.
Jan 04 13:58:17 GCT022 systemd[1]: apache2.service: control process exited, code=exit...s=1
Jan 04 13:58:17 GCT022 systemd[1]: Failed to start LSB: Apache2 web server.
Jan 04 13:58:17 GCT022 systemd[1]: Unit apache2.service entered failed state.
Jan 04 13:58:17 GCT022 systemd[1]: apache2.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
root@client022:/home/user22$ ^CNow I want to revert back or remove php7 that i can do the user machine active with the old version.
7 Answers
To remove php7.0 use
sudo apt-get purge php7.0-common 4 This will remove all php7 version, be it php 7.0 or php 7.1 etc..
sudo apt-get purge php7.* 4 As I have answered your question Unable to locate package php7.0 and you have accepted my answer and because you explicitly ask for a removal of the package:
sudo apt-get install ppa-purge
sudo ppa-purge ppa:ondrej/php-7.0 3 If you run Abhishek's it will remove other packages. On mine it was going to remove these too
The following packages will be REMOVED
libapache2-mod-php5.5* libapache2-mod-php5.6* php-common* php-gettext* php-igbinary* php-memcached* php-msgpack* php-pear* php-xdebug* php5-cli*
php5-common* php5-dev* php5-json* php5-memcache* php5-memcached*
php5-readline* php5-redis* php5-xdebug* php5.5-cli* php5.5-common*
php5.5-curl* php5.5-json* php5.5-mysql* php5.5-opcache* php5.5-readline* php5.5-xml* php5.6* php5.6-cli* php5.6-common* php5.6-curl* php5.6-fpm* php5.6-json* php5.6-mbstring* php5.6-mysql* php5.6-opcache* php5.6-readline* php5.6-xml* pkg-php-tools*
So you're better off with
sudo apt-get purge php7.* The way to remove PHP and dependencies is:
apt-get autoremove php7.0 4 to remove php7.x simpely use
sudo apt-get purge `dpkg -l | grep php7.2| awk '{print $2}' |tr "\n" " "` After doing a:
sudo apt-get purge php7.*to remove all versions of php7, you still need to run some extra steps to completely and utterly remove php7:
sudo apt-get autoremove --purgeThen do a:
whereis phpand then remove all directories in the output of the last command, E.G.:
sudo rm -rf /etc/php