PHP5.6 and its dependency can be found on Ondřej Surý repository. PHP5.6 is already installed on your system , you can install a single package
php5.6-curl
as follow:apt install apt-transport-https lsb-release ca-certificates wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list apt update apt install php5.6-curl
I need the curl for PhP5.6 to be used as default curl instead of PhP7.
You should add the PHP5.6 to update-alternative
, it will be used later to switch between the installed php version.
let’s say the php5.6
is configured to be installed under /usr/bin/php5.6
, the configuration commands should be:
Adding PHP5.6 to update-alternatives
:
update-alternatives --install /usr/bin/php php /usr/bin/php5.6 90
Set PHP5.6 as default:
update-alternatives --set php /usr/bin/php5.6
or you can use:
update-alternatives --config php
Then select php5.6
.
The best way is to install the php5.6
and its dependency from Ondřej Surý repository , when a php5.6 update is available , it will be installed through apt
.
来源:https://stackoverflow.com/questions/48399065/use-curl-php5-6-instead-of-curl-php7