I have three servers. Two are live servers hosting web sites for the internet. One is a local testing server, not visible on the internet at larger.
I am trying to run a PHP script that posts to Twitter, and it relies on curl. When I run the script on my local testing machine, it works perfectly. When I try and run it on either of my live servers, it fails with this error:
PHP Fatal error: Call to undefined function Abraham\TwitterOAuth\curl_init()
On my local machine, when I run php --info | grep -i curl
, I get this response:
/etc/php5/cli/conf.d/20-curl.ini,
curl
cURL support => enabled
cURL Information => 7.35.0
I only have SSH access to one of my live servers (the other is a paid hosting service that is more restricted), and when I run the same command on that server, I get no response. The command prompt comes back with nothing. However, if I go to the /etc/php5/cli/conf.d/
directory on my live server, there is a 20-curl.ini
file there.
All servers are Ubuntu based, and I've run apt-get install php5-curl curl
on all of them, and they all say they are running the latest version.
Here's the last confusing detail, on all servers, if I run this PHP script on any of my servers, my local test server and both live servers, I get a positive response. This is the code:
echo 'Curl: ', function_exists('curl_init') ? 'Enabled' : 'Disabled';
... and when I run it, I get this output:
Curl: Enabled
Bottom line, it seems curl is installed on all three servers, but something is wrong with the installation on both of my live servers.
What can I do to diagnose and solve why my live servers can't run the PHP script that my local test server can?