0

After compiling manually the version 5.6 of PhP on Debian 9 i need to install the curl for that version too but the problem is i don't see any lib on the repositories for PhP5 (?):

apt-cache search php | grep -i curl

php-curl - CURL module for PHP [default]
php7.0-curl - CURL module for PHP

I need the curl for PhP5.6 to be used as default curl instead of PhP7 ( requirement for website who is already using PhP5.6 instead of PhP7 ).

Any idea where i can get that curl version and set it as default ?

Thanks in advance.

6
  • 1
    If you compile manually that means you need to compile/include the libraries manually too. Check php.net/manual/en/curl.installation.php (it's not hard, you just need to add a --with-curl option) Commented Jan 23, 2018 at 10:16
  • After launching the configure again with the --with-curl option i get the configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl error, after that i've found that easy.h and added the --with-curl-dir=/usr/include/x86_64-linux-gnu/curl but it returns me at the end configure: WARNING: unrecognized options: --with-curl-dir so, how i can specify the file dir on that option? Commented Jan 23, 2018 at 10:45
  • that means you don't actually have the cURL library installed and therefore can't configure PHP to use it. All PHP dependencies need to be installed for configure to succeed Commented Jan 23, 2018 at 10:48
  • libcurl4-gnutls-dev ya está en su versión más reciente (7.52.1-5+deb9u3). 0 actualizados, 0 nuevos se instalarán, 0 para eliminar y 0 no actualizados. (That means it's already installed). curl -V curl 7.52.1 (x86_64-pc-linux-gnu) libcurl/7.52.1 Commented Jan 23, 2018 at 10:51
  • 1
    Hi, the convention here is to always add answers separate from the question, rather than editing them into place, even if it's your question. That way, every Q&A has the same format, and the software can know which questions have answers and show them differently to future users. Commented Jan 23, 2018 at 12:44

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.