A nice upgrade came about in the 1.9.18 release of App Engine SDK: PHP on App Engine can now support cURL. There are a few caveats that go with it, but it’s a nice step forward.
There are two implementations: cURL_lite and full fledged cURL.
To Enable cURL_lite
- Add the directive google_app_engine.enable_curl_lite = “1” to your php.ini file.
- cURL_lite is only allowed to make calls to HTTP or HTTPS clients
- cURL_lite didn’t work on my local development server without tweaking runtime to php55, but it works for php in production
- cURL_lite doesn’t require application to have billing enabled
To Enable cURL
- Change your runtime setting in your app.yaml from php to php55.
- Add the directive extension = “curl.so” to your php.ini file.
- cURL is only available in App Engine’s PHP 5.5 implementation
- cURL can only be used by applications that have billing enabled
- cURL is limited by the restrictions of App Engine’s sockets but include:
- Limited from targeting Google domains
- May be reclaimed after 2 minutes of inactivity
Now regardless of the implementation, you still call cURL using the “curl_” commands, just the underlying technology changes.
8 thoughts on “PHP on App Engine Does cURL”
IF you go ahead and host your PHP website through Google App Engine, then you will need to keep a copy of that app on your desktop and push every minor change to your live site.
In Google Compute Engine server deployed through Cloudways, you can easily edit your PHP website online and even connect Git easily and push changes from that;
Fair enough, Fahad. I would argue though that direct editing on a production server is not generally best practice. Publishing to App Engine from Git is a shell script away. And depending on your usage App Engine can allow for better pricing options. But yes, your product pitch is completely relevant to this explanation of a feature on another product.
Is that really true Fahad? You can use AppEngine Launcher (if you prefer having a UI) on your PC/Mac and set up a local environment to test there.
You can also connect your Github/Bitbucket account directly from Dev Console.
I am trying to integrate twilio/parse.com/google app engine. When I run it on a local server, the curl lite throws an error of “no url set”. So I change it to curl.so and it works fine locally, but then I can’t get it to serve on google app and send a text message while serving on google app engine. what is going on here?
Sorry for the late reply. Have you enabled billing?
I create a PHP file in Google App Engine with curl function to crawl data on Instagram using Instagram API. But my curl can’t be executed for 24 hours. Every day from 00 AM until 2 PM my curl always can’t be executed
Here is the detail of my question: http://stackoverflow.com/questions/39770055/google-app-engine-curl-not-24-hours-run
Can you please help me?
It would be nice if the post is highlighted problem the directive to add in the phi.ini file 🙂 It took me some time to correctly enable curl because I was just only putting curl.so in the .ini file and I never thought that the correct way of doing it is like this
extension = “curl.so”