Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Running PHP on Google App Engine - PHP Classes

Contents

* What is Google App Engine?

* Google App Engine with Java support

* Running PHP applications on Google App Engine

* Share your experiences with PHP on Google AppEngine

* What is Google App Engine?

As some of you may remember, about 1 year ago, I posted an article about Google App Engine,
a cloud computing environment that Google has been working on to host Web applications in a
way that, in theory, it provides automatic scalability, so sites can handle large audiences without
having to plan and invest on servers to handle large loads.

http://www.phpclasses.org/blog/post/77-Google-App-Engine-nee ...

* Google App Engine with Java support

As it is explained in the article above, initially Google only provided support to run Python
applications.

Meanwhile, last week Google announced the support of Java to run applications on Google App
Engine.

http://googleappengine.blogspot.com/2009/04/seriously-this-t ...

* Running PHP applications on Google App Engine

As some of you may be aware, thanks to Quercus project, it is possible to run PHP 5 applications
on environments that have a running Java Virtual Machine.

http://www.caucho.com/resin-3.0/quercus/

A PHP developer named Roshan just reported that he successfully run a PHP application on
Google AppEngine using Quercus.

http://www.phpclasses.org/discuss/blog/PHP-Classes-blog/post ...
Here you may learn more details about this experience:

http://www.webdigi.co.uk/blog/2009/run-php-on-the-google-app ...

* Share your experiences with PHP on Google AppEngine

This is not an ideal solution because it is not native PHP support, as many of use hoped, but it is
indeed some progress.

It would be interesting if anybody could share your results, specifically what are the limitations
and what are the benefits of running PHP on this environment compared to traditional hosting
environments.

As a side comment, PHP applications can also run wherever there is a .NET virtual machine,
thanks to the Phalanger project, which by the way is sponsored by Microsoft.

http://www.php-compiler.net/

So, in theory it should be possible to run PHP applications in Windows Azure, Microsoft cloud
computing environment, as it was explained in this article:

http://www.phpclasses.org/blog/post/85-What-is-Microsoft-up- ...

If you have tried running PHP on these cloud computing environments, feel free to post your
comments here.
Google launched their Google App Engine (GAE) a year ago. The free hosting in App Engine is
allocated 500 MB of persistent storage and enough CPU and bandwidth for about 5 million page
views a month. Also, if you really want more you can see pricing plans.

GAE will support Java going forward. Unfortunately PHP support on the App Engine is still left
as the top item in the wishlist. So until Google announces their official PHP support we have a
workaround to run PHP using Quercus. Quercus is basically a 100% Java implementation of the
PHP language (requires JDK 1.5).  Since the App Engine now supports Java this means we can
use Quercus to run PHP scripts on the App Engine.

So all you need to use the GAE and run PHP


1) Register a free account.
2) Download this file to your computer.
3) Edit application XML tag in the file war\WEB-INF\appengine-web.xml to the name of the
application you have registered.
4) Finally upload your application. I downloaded Google App Engine SDK for Java and use the
following command in windows.
appcfg.cmd update C:\projects\phpwithjava\war

To see this in action just visit:


http://phpwithjava.appspot.com/webdigi.php and http://phpwithjava.appspot.com/info.php

NOTE: phpwithjava is my app name with GAE. Image by Aral Balkan.

How much free quota does each App Engine app receive?

An application without billing enabled is allocated 500 MB of persistent storage and enough
CPU and bandwidth for about 5 million page views a month. The Admin Console's Quotas page
lists every quota and provides a breakdown of how much your application is consuming per
resource.

What happens to my free quota once I've enabled billing?

Free quota remains the same once billing is enabled. An app won't be charged until it exceeds its
free quota, at which point the billed administrator will be charged based on any such usage up to
the maximum daily budget.

For more information on how enabling billing adjusts the free quotas, see Quotas.

Are billable resources rate-limited?

Yes—when billing is enabled, each resource is configured individually to allow for about 500
requests per second. You can check the status of each from the Quota Details page in the Admin
Console.

For more on these per-minute limits, see Quotas.


How can I track or verify my quota usage?

Sign in to the Admin Console and select the application you wish you inspect. Quota usage is
located within the "Quota Details" page. Additional usage information may be found on the app's
"Usage History" page, linked from the left-hand navigation.

Do my datastore indexes consume my billable quota?

Yes, datastore indexes do count against an application's storage quota. There are three general
index types: kind for querying entities by type, property for querying entities by a single property
value, and custom for complex queries using multiple sort orders or a combination of equality
and inequality filters. For a detailed breakdown of these three types and the data stored for each,
see How Entities and Indexes are Stored.

What if I anticipate even more traffic than allowed by the per-minute quotas?

All applications with billing enabled are able to scale to around 500 requests per second (qps) or
more than 40 million queries per day, which is enough to handle traffic from being Slashdotted
or Dugg. In extreme cases (e.g. your application has been featured on Yahoo's homepage), you
can request additional CPU using this form.

How will I be charged for partial units?

Your actual usage of any resource on a given day will be rounded down to the nearest base unit
and then rounded up to the nearest cent. The base units for the adjustable quotas are:

 CPU Time: 1 megacycle = 1/1200 CPU second


 Bandwidth in/out: 1 byte
 Storage: 1 byte
 Email: 1 email

For example, if your app transfers 21,582,210,662 bytes over and above the amount allowed by the free
quota, this is equivalent to $2.412 (at $0.12 per GB transferred out). The charge for that day would then
be $2.42 for this resource.

You might also like