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.
The procedure to install cURL on Ubuntu Linux is as follows: Update your Ubuntu box, run: sudo apt update && sudo apt upgrade. Next, install cURL, execute: sudo apt install curl. Verify install of curl on Ubuntu by running: curl --version.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With