Fixing Google App Engine for PHP


Ever since Google App Engine decided to support PHP,  I said I would give it a try and I finally took took the leap.  And of course, as to be expected when trying something new, you typically fall flat on your face the first time you try.  So after creating a new application and installing the SDK, I try to run my app locally… I cross my fingers and hit Run… wait for it…

Screen Shot 2013-10-28 at 8.53.57 PM

Of course… big fat fail… anyways, I click ignore hoping it will still work.  I hit Browse and a new browser opens up… and then…

The PHP interpreter specified with the –php_executable_path flag (“/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/php-cgi”) is not compatible with the App Engine PHP development environment.

"/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/php-cgi -v" returned an error [-11]

Okay… guess this isn’t meant to be… and after doing some Google searches, I find others having the same problem.  Anyways, after some research and dumb luck, I was able to get my local app working by running the following from my console:

dev_appserver.py --php_executable_path=/usr/local/php5/bin/php-cgi /path/to/app

So that got me thinking and I decided to update the php-cgi reference inside the GoogleAppEngine resource folder. I simply renamed the existing php-cgi instance and I created a symlink to the version I manually installed:

 ln -nsf /usr/local/php5/bin/php-cgi php-cgi

So after doing this, I was finally able to use the App Engine Launcher.  I’m sure the packaged php-cgi just needs to be updated.  I saw some comments about how this only happens if you’re on OS X 10.7.5 – so maybe if I upgrade to Mavericks, it will be resolved.  Anyways, I thought I would just post this in case someone else needs a quick-fix.