How to run PHP on Google APP Engine

To have php run on GAE you need Quercus, though the name appears some difficult the process is much simple than expected, you just need to add few jar files change some settings and thats will have your php code running on google app engine

The biggest problem during the whole process is to get the exact jar files

Google helped me find a SVN repo out there that had the 3 jars I needed, and  after loading them into the correct folder. Eclipse stopped throwing errors.  If you’re looking for the files I used, you can find them here:  I determined that quercus.jar, resin_util.jar, and script-10.jar were needed for Quercus to do its thing correctly… at least that’s what I think.  Drop them in the WEB_INF/lib folder and you should be all set.

Now the actual process starts.

Step -1 Edit Web.xml file to have following lines of code

<servlet-name>Quercus Servlet</servlet-name>


<servlet-name>Quercus Servlet</servlet-name>

I don’t know if any order is important here, but I put the php servlet first, followed by the default servlet, followed by the php servlet-mapping, followed by the default servlet-mapping.

Next on the list is appengine-web.xml. Add the following code right after closing of system-properties tag

<exclude path="/*.php" />
<include path="/**.php" />

Next to create one php.ini file in war/WEB-INF folder. Currently i kept it blank.

Now the final step is to create some php files to check. I created simple file that echo phpinfo to check php running fine at location war/index.php

Initially when I tested this out I was getting a strange error about org.mortbay.util.ajax.Continuation not found.  I don’t know what that is, but its included in the jetty-util-6.1.0.jar file, which I found here.  I’m unsure if this is specific to the development platform or required by Quercus

Now that’s it  I included that jar and my php started working on local instance of GAE application

I deployed on app engine, and there too it started smoothly.

Live Example

Github Hosted Project


5 thoughts on “How to run PHP on Google APP Engine

  1. Dude….

    You are simply great….

    Now, I want to know how to use mysql in GAE.
    Read lot of articles but yours is simply great and more importantly works.

    Thanks and waiting for mysql help in GAE.

What you think ? Leave a Reply

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

You are commenting using your 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