In my last post I outlined getting Go and PHP to act as modules in the same App Engine instance. However I only really tested it on a “production” App Engine instance, I didn’t test it in development, because I typically use the Google App Engine SDK for each respective language separately.
When I tried the combined dispatch.yaml on the Google App Engine SDK for PHP I got the following error on a Mac running OS 10.10.2 (Yosemite):
OSError: [Errno 2] No such file or directory: '/Applications/Development/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/goroot/pkg/tool’
When I tried the combined dispatch.yaml on the Google App Engine SDK for Go I got the following error:
The development server must be started with the --php_executable_path flag set to the path of the php-cgi binary.
And when used the -php_executable_path option with any of the copies of PHP on my system – including the ones that are buried in the PHP SDK – I got:
_PHPEnvironmentError: No input file specified.
After struggling a bit with this here is the easiest solution I found:
-
Find the location of goroot in the go_appengine folder
-
Find the location of the SDK for php by running
which dev_appserver.py | xargs ls -l
-
Create a symbolic link to goroot in go_appengine in the PHP SDK folder that contains dev_appserver.py
After that you can test your dispatch file in development by running:
dev_appserver.py dispatch.yaml api_php/app.yaml api_go/app.yaml
Where api_php is the folder your PHP module is in, and api_go is… well you know what I’m saying.
Now, I went out of my way there to say this was the easiest way of doing it. Not that it wasn’t a hack, or that it was a supported way of doing it. But it does work.
All code show here is licensed under Apache 2. For more details find the original source on Github.
terrence thanks for sharing.
i use the nice little app engine launcher which supports php/py. with a multi-stack configuration it looks like i might have to forgo those niceties.
LikeLike