PHP on App Engine Does cURL

AppEngine_512pxA 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

  1. Add the directive google_app_engine.enable_curl_lite = “1” to your php.ini file.

Caveats

  • 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

  1. Change your runtime setting in your app.yaml from php to php55.
  1. Add the directive extension = “curl.so” to your php.ini file.

Caveats

  • 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.

Supporting Documentation

8 thoughts on “PHP on App Engine Does cURL

    1. 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.

      Like

    2. 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.

      Like

  1. Hi,

    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?

    Like

  2. 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”

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s