Rocco The Taco Rocco The Taco - 3 months ago 42
Apache Configuration Question

PHP 5.6 will not run CURL

I have Ubuntu 12.04 with PHP 5.6.11 and running Apache/2.4.12. I've installed CURL by running

sudo apt-get install php5-curl

and restarting:
sudo service apache2 restart

At the command line I type
curl -V
and get the following:

curl 7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/ libidn/1.23 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

and when I type
which curl
I get the following:

So I'm fairly certain that curl is installed.

When I use
on a php page called from a web browser, there is no block for curl and any reference to curl for that matter.

My understanding was that curl should work fine based on this question/answer without any configuration changes which is clearly not the case.

Can someone point me in the right direction to modify PHP config files or what commands I need to run to get CURL to run with PHP on my version?

Attached are the config file locations found in phpinfo()

Configuration File (php.ini) Path /etc/php5/apache2

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

Scan this dir for additional .ini files /etc/php5/apache2/conf.d

Additional .ini files parsed /etc/php5/apache2/conf.d/05-opcache.ini, /etc/php5/apache2/conf.d/10-pdo.ini, /etc/php5/apache2/conf.d/20-json.ini, /etc/php5/apache2/conf.d/20-mysql.ini, /etc/php5/apache2/conf.d/20-mysqli.ini, /etc/php5/apache2/conf.d/20-pdo_mysql.ini, /etc/php5/apache2/conf.d/20-readline.ini

Answer Source

First, check that the extension is installed (with relevant example output):

$ sudo find / -name\*

Then, check that the extension is enabled (again with relevant output):

$ grep -Ri curl /etc/php*

If the first command doesn't produce any output, then the module wasn't installed. You'll need to diagnose why your system package manager didn't install the package. For Ubuntu, you might need to run sudo apt-get update.

If the first command worked, but the second didn't, you'll need to enable the extension, then restart Apache afterwards:

echo '' | sudo tee /etc/php5/apache2/conf.d/99-curl.ini
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download