25 mei 2009

Using PHP on GAE

Google is now supporting 2 languages for Google App Engine: Phyton and Java. This article shows how you can use PHP on Google App Engine.

Running PHP on GAE is possible by using Quercus from Caucho, Quercus implements PHP in Java, see below URL's about running Quercus on GAE>
Assuming you have a Google App Engine website running with Java enabled and also localy installed the GAE Java SDK and the Google Eclipse plugin.

Assuming also that you did the Java Getting Started tutorial to get hands-on experience with the GAE Java SDK and the Google Eclipse Plugin.

Then you can also get PHP running on GAE with below steps.

1) Create a Google Web Application inside Eclipse

Optional: De-select GWT on the "New Web Application project" wizzard.

2) Copy resin.jar from Resin 4.0 to WEB-INF/lib

Add resin.jar to the java build path: Right-click on the project-name, select 'properties' then 'Java build path' and the add resin.jar under 'Libraries'

3) Modify war/WEB-INF/web.xml so that it contains (also) below content


4) Add below lines to war/WEB-INF/appengine-web.xml
<exclude path="/**.php" />

<include path="/**.php" />
5) Create the war/index.php file.


6) Run the development server.

7) Surf to: http://localhost:8080/

6 opmerkingen:

Anoniem zei

Why don't you post a detailed description on how to get to run your PHP code on appengine, I've been reading blogs for hours and no one really explains how to get it to work, all describe the magic 4 steps only, which of course don't work.

Thank you

Anoniem zei

aichholzer: If you have a concrete question I would be glad to help you. However I don't think I must duplicate what Google has done. The Google documentation is very good.

That's why I did wrote below line in this blog posting:

"Assuming also that you did the Java Getting Started tutorial to get hands-on experience with the GAE Java SDK and the Google Eclipse Plugin."

Anoniem zei

I am unable to upload because the resin.jar is too big. thoughts?

PHP on Google App Engine zei

This helped me a lot to get it working. I created a package with newer libraries just recently. I'd like to see more of your post related to this topic!


jessec zei

try this appengine-java-sdk-1.3.8/bin/appcfg.sh --enable_jar_splitting update /locationof/war/

php_tryer zei

Hi, I really do appreciate the time that is taken to show us all how to do things but I have to agree with aichholzer, I also can do everything right up to the PHP conversion then all I get is a server error. Getting pretty disheartened I've read loads and loads of blogs and tutorials. It deplyes without error but i get:-

Error: Server Error

The server encountered an error and could not complete your request.
If the problem persists, please report your problem and mention this error message and the query that caused it.

I'd love a step by step guide