先用这位网友的: https://whycan.cn/t_3445.html#p30643
找到一个网站
https://vitux.com/how-to-install-php5-and-php7-on-ubuntu-18-04-lts/
安装 php5.6:
sudo apt-get update
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php5.6
php7.4 很容易安装:
sudo apt-get install -y php7.4
离线
https://mobilefish.de/use-multiple-php-versions-ubuntu-apache-2cli-and-switch-php-modules
sudo apt install php7.1 php5.6 php7.0
sudo apt install libapache2-mod-php7.0
sudo apt install libapache2-mod-php7.1
sudo apt install libapache2-mod-php5.6
sudo apt-get install php5.6-curl php5.6-mysqli php5.6-mbstring -y
sudo apt-get install php7.0-curl php7.0-mysqli php7.0-mbstring -y
sudo apt-get install php7.4-curl php7.4-mysqli php7.4-mbstring -y
#禁用php7.4
sudo a2dismod php7.4
#启用php5.6
sudo a2enmod php5.6
#apache2 重启
sudo service apache2 restart
要注意 php7.4-mysql 已经不存在了, 现在是 php7.4-mysqli
离线