Google app engine php tutorial in windows. Getting started hello worldexample. GAE development and deployment
Posted by ashok raj at Saturday, October 12, 2013 4:48 PM
Google App Engine (GAE) is a platform as a service (PaaS) cloud computing platform for developing and hosting web applications. Recently Google has made Google App Engine PHP runtime support fully available to the general public, meaning you can run your PHP applications in the Google Cloud Infrastructure with various pricing plans.
I've never used App Engine before and thought of give it a try. I thought I might have to put a lot of workaround for setup and deployment of the project. But I am really impressed by its simplicity of creation and deployment of the project. Also they provide a simple GUI called Google App Engine Launcher for making the application management simpler.
Lets get started,
Creating the Application
1. Go to http://www.python.org/getit/releases/2.7.4/ and download the Python MSI installer for windows and install the application.
2. Then download the PHP SDK for App Engine from the link http://googleappengine.googlecode.com/files/GoogleAppEngine-1.8.5.msi and install the application.
3. After Installing Python and App Engine PHP SDK, Open the Google App Engine Launcher application,
4. Go to menu bar and click File -> Create New Application,
5. Fill up the Application Name, Parent Directory, Runtime (PHP), Port and Admin Port.
6. The application will be created and listed out in the GAE launcher.
7. Open the Parent Directory in Explorer, You can see the application folder got created.
8. The new empty application folder will have app.yaml file, main.php file and a favicon.ico file.
9. The app.yaml file will have the application configurations, and by default it is configured in a way that main.php will handle all the requests coming into the application. We'll see the configuration options later and run the application first.
10. Now open Google App Engine Launcher Click Run button given above (Control -> Run),
11. Now goto http://localhost:8080 or to whatever port you have given. You can see the "Hello World!" over there.
If the application is not starting goto Edit -> Preferences, and fill up the required details.
It is said that the default values will be used if it is not set. But for me, Unless I set it manually, The application was not running. Try with the above details. If it is still not running, Try adding the Deployment Server value with "C:Program FilesGooglegoogle_appenginedev_appserver.py" in the preference and try again.
The given demo is done in Windows 8 machine. But when I tried with Windows XP, I've got the error message "The procedure entry point InitializeSRWLock could not be located in the dynamic link library KERNEL32.dll" and I couldn't resolve it though.
Deploying application to Google App Engine
12. Go to https://appengine.google.com/ , Login with your Google account and Click create application.
13. Fill up the Application ID, Title and leave the other options to default and Click Create Application.
14. After creation, You can see a dashboard for the application. Lets not get complicated and start with deploying the application.
15. Now lets create an application to deploy to App Engine, Or you can use your old application itself. Make sure to change the "application:" in the app.yaml with the Application Identifier you've registered with Google App Engine.
16. Select the application and click the Deploy button ( Control -> Deploy )
17. The below window will be opened and the application will be deployed to the Google App Engine.
Bazinga!! Your PHP application is running in Google App Engine Cloud Infrastructure.
I'll explore what else we can do with PHP in Google App Engine and will blog in the upcoming posts.