简体   繁体   中英

cURL not loading for Ubuntu 16.04.3 with PHP 5.6

I have a Ubuntu 16.04.3 server that when I use phpinfo() I find that the server is using PHP Version 5.6.11 on Apache/2.4.18.

I installed curl and when I run sudo find / -name curl.so\\* I get returned

/usr/lib/php/20151012/curl.so

phpinfo() shows the following additional .ini file: /etc/php5/apache2/conf.d/99-curl.ini

The contents of this file are extension=/usr/lib/php/20151012/curl.so

When I run the following on a php page:

var_dump(function_exists('curl_init')); print

I get bool(false)

This occurs even after a sudo service apache2 restart

How do I get CURL to run in my PHP pages?

Most likely, the reason it is not loading is because the API version 20151012 is for PHP 7.0 and not 5.6, so that curl extension module is not compatible with 5.6.

If you do sudo apt-get install php5-curl you should get the right extension which should get installed to /usr/lib/php/20131226 .

The Apache error log should have a startup error saying that the module is not compatible and might offer more detail as to why it's not being loaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM