开发者

Can't Install libcurl PHP on Ubuntu Linux

开发者 https://www.devze.com 2022-12-28 17:35 出处:网络
I am trying to use the new facebook api and it requires libcurl PHP.I used sudo apt-get install php5-curl

I am trying to use the new facebook api and it requires libcurl PHP. I used

sudo apt-get install php5-curl
sudo apachectl -k restart

And it didn't work. I get the same error and the phpinfo() page says nothing about libcurl.

The source of this problem is probably that I built some of the tools from source (apache2, php), but then I got bored so installed a lot of the extensions with the package manager. But I'm not exactly how to go about diagnosing the point of failure.

The apt-get install for curl definitely worked, and can be found in

/usr/lib/php5/20060613/curl.so

I think a lot of my confusion stems from not knowing which files go where, and what purpose the开发者_如何学Goy have. Any help would be appreciated, and please tell me if I need to provide more information.

edit: The specific error I get is:

Exception: Facebook needs the CURL PHP extension.

from line

if (!function_exists('curl_init')) {
  throw new Exception('Facebook needs the CURL PHP extension.');
}

Ubuntu: 9.10

PHP: 5.2.13

Loaded Configuration File: /etc/php5/apache2/php.ini


In general it's a bad idea to mix and match software from your distribution's package manager with stuff you've built yourself. The package manager will not know anything about the stuff you've built yourself and so can get confused.

Not only that but who's to say the stuff from the package manager is even binary compatible with the stuff you've built yourself? If you build it all yourself then at least you know it will all be compatible.

Sounds to me like you should uninstall the extensions and build them yourself. If you can't or don't want to do that then go back and install apache and friends through your package manager but I would recommend having patience and going for the former option.


Answer of Questions

What version of Ubuntu?

What version of PHP?

How is Apache and PHP set up?

What ini files does phpinfo() say is parsed? (should be near the top)


Perhaps apt failed to properly modify your php.ini file to load the curl extension?

Check out your php.ini and see if you have line like:

extension=curl.so

or maybe:

extension=/usr/lib/php5/20060613/curl.so


To check if php-curl is installed please follow these steps:

  1. Create a file in your web server (in Ubuntu it would be in /var/www folder), name it info.php
  2. Open that file and type this command:

    <?php phpinfo(); ?>
    
  3. Save that file

  4. Open your favorite browser and open that file (ex: http://localhost/info.php)
  5. Now you will see the Information about your PHP installation
  6. Search for Curl, and if you cannot find it, it mean your php doesn’t have curl installed.

To install php-curl please follow these steps:

  1. Open your terminal and type this command:

    sudo apt-get install curl libcurl3 libcurl3-dev php5-curl php5-mcrypt
    
  2. After it finish open php.ini file (mine is at /etc/php5/apache2/php.ini ) and add this command: extension=curl.so

  3. Save the file and restart apache with this command:

    /etc/init.d/apache2 restart
    
  4. Check the PHP information page again, you will find PHP-CURL installed
  5. That’s it

Source: http://www.ivankristianto.com/os/ubuntu/howto-install-curl-in-php-apache/379/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号