简体   繁体   中英

Trouble Enabling cURL on Ubuntu 11.10

I have installed curl:

sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

and I have updated my php.ini file to include:

extension=php_curl.dll

I check to see if curl is working with the following command:

php -i | grep curl

and I receive the following message:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/php_curl.dll' - /usr/lib/php5/20090626+lfs/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/sqlite.so' - /usr/lib/php5/20090626+lfs/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0 Additional .ini files parsed => /etc/php5/cli/conf.d/curl.ini, curl

I also tested curl by creating a file called testCurl.php which contains the following:

<?php
echo ‘<pre>’;
var_dump(curl_version());
echo ‘</pre>’;
?>

When I navigate to localhost/testCurl.php I get an error: HTTP Error 500

Can anyone help me to get curl working?

You put the wrong info in your php.ini

extension=php_curl.dll

On Ubuntu/Unix that is

extension=php_curl.so

.so means Shared Object , that is a dynamic library the error messages speaks of. On Windows that is .dll , you probably just mixed that.

And it appears you try to load sqlite.so which does not exists. Normally you don't need to change your php.ini file when you install libraries on Ubuntu via apt, because the package scripts take care of that thanks to the work of the package maintainers.

If you'r using Ubuntu or have more than one php.ini you may face this problem of enabling extension=php_curl.dll.

It's curious but I was facing this problem using UBUNTU. For some reason it was calling a .dll file, but linux uses .so files.

First thing to do is echo phpinfo(); in a .php file to check what php.ini is getting loaded.

Configuration File (php.ini) Path /etc/php/7.1/apache2 Loaded Configuration File /etc/php/7.1/apache2/something/php.ini

So if you change only in one file it may not have the correct effect.

In my case whas in /etc/php/7.1/apache2/php.ini and CURL was calling this way: ;extension=curl.dll

Change to extension=curl.so

Save and restart apache: sudo systemctl restart apache2

Support for sqlite2 is removed from php5 I think, so sqlite.so is no longer available in the current version of the package. You can manually restore it from the natty packages (this worked for me):

(https://lists.ubuntu.com/archives/ubuntu-server-bugs/2011-October/065547.html)

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