Quick Start WordPress for Google App Engine

A guide for running WordPress on Google App Engine

View the Project on GitHub GoogleCloudPlatform/appengine-php-wordpress-starter-project

This simple tutorial will take you through setting up and running WordPress on Google App Engine. The version of WordPress supplied comes pre-configured with an app.yaml file and some useful open source plugins that optimise WordPress for App Engine.


  1. Install the PHP SDK for Google App Engine
  2. Install MySQL server


Creating and configuring your project

Sign up for a Google Cloud Platform project, and set up a Cloud SQL instance, as described here. To keep costs down, we suggest signing up for a D0 instance with package billing. You'll want to name your Cloud SQL instance "wordpress" to match the config files provided here. For best performance, set it to follow your App Engine application underneath the Location setting. When signing up, be sure to select Assign IP Address, and add your IP address to the list of Authorized IP Addresses. After your Cloud SQL instance is created, go to the Access Control section of your instance and click on Users. Click New User and create a user with the name root and specify a password. Now you can connect to your Cloud SQL instance using 3rd-party tools, which we'll do later.

Editing your config files

Edit app.yaml and wordpress/wp-config.php, replacing any instance of your-project-id to match the Project ID (not the name) you entered in the Cloud Console when you signed up for a Google Cloud Platform project.

Running WordPress locally

First, edit wp-config.php so that the local environment password for root is not literally the string "password" -- unless that's what you used when setting up MySQL locally.

Using MySQL, run the following commands to set up your local database. Note that you will be prompted for your password and enter the MySQL shell after the fist command:

{PATH_TO_MYSQL_BIN}/mysql -u root -p
create database wordpress_db;

To run WordPress locally on Windows and OS X, you can use the Launcher by going to File > Add Existing Project, then clicking Run, or you can run one of the commands below.

On Mac and Windows, the default is to use the PHP binaries bundled with the SDK:

$ dev_appserver.py path_to_this_directory

On Linux, you run the same command, only you provide an extra argument that points to the PHP CGI executable. For example:

$ dev_appserver.py --php_executable_path=~/php-5.4.25/installdir/bin/php-cgi path_to_this_directory

Now, with App Engine running locally, visit http://localhost:8080/wp-admin/install.php in your browser and run the setup process, changing the port number from 8080 if you aren't using the default. (If you're using the Launcher, you can just select the project in the list and click Browse.) You should be able to log in and see the dashboard for your WordPress site.


If all looks good, you can upload your application using the Launcher (just select the project and click Deploy), or by using this command:

$ appcfg.py update APPLICATION_DIRECTORY

Just like you had to do with the local database, you'll need to set up the Cloud SQL instance. So, fire up the MySQL client again to run the below commands. This is the step that made it necessary to assign an IP address to your Cloud SQL instance (INSTANCE_IP below), and authorize your IP address during the Cloud SQL setup phase.

{PATH_TO_MYSQL_BIN}/mysql --host=INSTANCE_IP --user=root --password
create database wordpress_db;

You should see that it inserted 1 row of data creating the database -- and with that, you're done. If you ever need to run arbitrary SQL commands against your Cloud SQL instance in the future, now you know how!

Now, just like you did when WordPress was running locally, you'll need to run the install script by visiting:


Almost done!

Activating the plugins

Log into the App Engine Admin Console at http://appengine.google.com, and click your freshly-deployed WordPress project. Click Application Settings on the left nav, scroll to the bottom, and click the Create button underneath Cloud Integration. This makes sure you have a Google Cloud Storage bucket active, enabling you to upload media from within WordPress.

Next, log in to the WordPress dashboard for your site using the credentials you entered when installing WordPress, and navigate to Plugins. Click the Activate links for both Google App Engine for WordPress, and Batcache Manager. Then, click Settings underneath Google App Engine for WordPress. On this page, confirm your default bucket name shows up (<PROJECT_ID>.appspot.com), and - this last step is important - click Save.

Now your site is ready to rock!

You're done!

Congratulations! You should now have a blog that loads rapidly, caches elegantly, sends email properly, and can support adding images and other media to blog posts! Most importantly, it will take advantage of Google's incredibly powerful infrastructure and scale gracefully to accomodate traffic that is hitting your blog.

Note: You'll want to keep that local copy of WordPress handy, because you'll need it to install custom themes and plugins. Because of the security sandbox, your live WordPress site can not write to the local files -- they're static. This means the auto-installation of themes and plugins in the WordPress dashboard will only work in the local WordPress that you run on your own machine. So, remember to do all your installing locally, then re-deploy your WordPress app.