Getting the PHP runtime for App Engine to run on Ubuntu

AppEngine + PHPExciting news out of Google I/O 2013 reveals PHP support on Google AppEngine. As a php and a appengine-nerd, this is great news. And setting up the local development environment on Ubuntu (13.04) was a breeze.

The PHP runtime for AppEngine requires the cgi-version of php 5.4 (and above) and python  2.7 (and above). Most Ubuntu-installations have python installed, but i’ll cover those steps as well, feel free to skip those if they are redundant for you.

Installing Python

sudo apt-get install python

Installing php5-cgi
(this should be safe to install even if you currently have a php-version installed since it’s the cgi version)

sudo apt-get install php5-cgi

Grabbing the AppEngine for PHP SDK

wget http://commondatastorage.googleapis.com/appengine-php/appengine-php-sdk-1.8.0.zip
unzip appengine-php-sdk-1.8.0.zip

Starting a local AppEngine instance using php5-cgi

./dev_appserver.py /path/to/your/app –php_executable_path=/usr/bin/php5-cgi

Your app should now be serving on http://localhost:8080/.

More details can be found in the official documentation:
https://developers.google.com/appengine/docs/php/gettingstarted/