7

I am currently trying to enable cURL on my EC2 server (free tier).

I have installed php5_curl and I am able to run curl through php via SSH.

I am using the following file to see whether cURL has been installed correctly.

testCurl.php

<?php
    function _iscurlsupported() {
            if (in_array ('curl', get_loaded_extensions())) {
                return true;
            }
            else {
                return false;
            }
    }

    if (_iscurlsupported()) {
            echo "cURL is supported\n";
    }
    else {
            echo "cURL isn't supported\n";
    }
?>

The command via ssh: php testCurl.php displays that curl is supported. The command when I access it through a brower displays that curl ISN'T supported.

I have checked the php.ini file located in php5/apache2 (the php.ini file that the browser loads (tested through another script)) and the extension is no where to be found.

I have checked the "extensions_dir" directory located on my server and the curl.so file is located there.

I am unsure why I am unable to run curl when accessing my script via the browser.

Any help would be greatly appreciated.

Cheers, jt234

Note: If you require any more information please ask. My problem is similar (if not the same as) Unable to use PHP curl on amazon ec2 free tier but the issue hasn't been resolved.

Community
  • 1
  • 1
rmplanner
  • 97
  • 1
  • 2
  • 8
  • Probably Amazon doesn't want you turning their free service into a webproxy. – Marc B Sep 05 '12 at 04:11
  • Very unsporting of them! –  Sep 05 '12 at 04:14
  • Turns out you can. You have to manually add 'extension=curl.so' to the php.ini file located in apache2. (for future reference) – rmplanner Sep 05 '12 at 04:37
  • Which OS is this? Linux/windows? I have an Ubuntu server on ec2 free tier and i was able to get curl to work just by installing it(curl and php5-curl)! Make sure you have made changes to the php.ini that apache-php is picking up. I think curl is enable for your php-cli but not you php over the webserver. – Eswar Rajesh Pinapala Sep 06 '12 at 21:51
  • Take a look to http://stackoverflow.com/questions/11598810/unable-to-use-php-curl-on-amazon-ec2-free-tier – Lobo Sep 07 '12 at 10:54
  • is your problem solved? please close it then or flag it to the moderators. – Jan Prieser Sep 07 '12 at 13:42

1 Answers1

7

In the end of your php.ini file add the line:

extension=curl.so

if you want to find where it is located you can run over SSH:

$ locate curl.so

it should be in something close to: /usr/lib/php5/20090626+lfs/curl.so

Ddorda
  • 399
  • 1
  • 10