Ubuntu 18.04.4 uninstall php7 and install php5.6

The php version installed by the default source is version 7.x. We all know that php7.0 has abandoned many old versions of functions and other content. This is fatal to the old system. Then, we have the need to install the old version of php , And if two versions of PHP are installed on the same host, an error will be reported if you do not configure them. Then, we need:

1. Uninstall php7.x;

1) If we know that those packages and extensions were installed when php7 was installed, we can directly use the command (php_xxx to install the php set extension for you) to uninstall;

sudo apt-get - -purge remove php_xxx

2) I don't know which extensions are installed, you can use the following methods to uninstall;

a, install aptiude

sudo apt-get install aptitude

b. Retrieve and uninstall the existing version of php

sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

2. Install the old version of php (I take php5.6 as an example here)

1) Add support for php5.6 source

sudo add-apt-repository ppa:ondrej/php

2) Update ubuntu source

sudo apt-get update

3) Install php5.6 and common components

sudo apt-get install php5.6
sudo apt-get install php5.6-gd
sudo apt-get install php5.6-mysql
sudo apt-get install php5.6-mbstring
sudo apt-get install php5.6-zip

sudo apt-get install php5.6-curl

 

Apache2 restart:

sudo /etc/init.d/apache2 restart

Guess you like

Origin blog.csdn.net/ny18002122997/article/details/112915746