Reputation: 240
I'm facing this error in php file Fatal error: Call to undefined function curl_init()
when I upload my file on Google appengine gae then I get this error:
I'm trying this cURL in PHP
function getpage($url)
{
// fetch data
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; Android 5.0; ASUS_T00J Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.133 Mobile Safari/537.36');
$data = curl_exec($curl);
curl_close($curl);
//return preg_replace('~[\r\n]+~', ' ', $data);
return $data;
}
The error is found on this line $curl = curl_init();
How can I remove this error?
Upvotes: 0
Views: 732
Reputation: 306
You need to install curl.
Windows: Go to your php.ini file and remove the ; mark from the beginning of the following line:
;extension=php_curl.dll
Ubuntu: ubuntu 13.0 and above, simply use the debundled package. In a terminal type the following to install it and do not forgot to restart server.
sudo apt-get install php5-curl
On GAE:
To Enable cURL_lite
google_app_engine.enable_curl_lite = "1"
to your php.ini file.Caveats
To Enable cURL
Caveats
Upvotes: 4