A Comprehensive Guideline on Hosting WP site on Google Engine

Hosting WP site on Google Engine

With the Google announcing its support for the most popular and widely used programming language PHP in the form of Google App Engine, WordPress users have already started seeing it as an opportunity to expand the potential of their website. It has come as a good news for the WordPress community as they can now host their website in its cloud while leveraging the benefits provided by App Engine’s to improve the reliability, scalability, and stability of the platform.

With WordPress is all set to take the advantages of Google App Engine and the fact that now it now powers a significant portion of the web, the majority of WordPress users will likely to use this service with their website for sure. So, if you are a WordPress user and taking a keen interest to host your platform in Google App Engine, then you have come to the right place. Here, I am going to guide you about the steps you need to take to accomplish your goal and thus give a boost to your website.

Just follow the step-by-step instructions below to start using Google App Engine to run your WordPress site.

Prerequisites of Installation WordPress in Google App Engine

1. Install the PHP SDK for Google App Engine
2. Install My SQL Server
3. An installation of Python

Getting Started

Step 1

To begin with, simply sign up for the Google Cloud Platform, and set up a Cloud SQL instance. Since you’ll need it later. Setting up instance is extremely simple. Just create a new project within the Google Developer’s Console and you are done.

You’ll see a screen like this:

Google Cloud Platform
Fill the required details here. Now, navigate to Storage > Cloud SQL > New Instance. Here, you’ll be asked to give a relevant name to the instance. For this, you can name it as “WordPress”, to make it similar with the configuration files. You can turn on billing so that you remain connected with the instance.

Step 2

In this step, we will proceed to create a local serve to host WordPress in Google App Engine. You need three files here to complete the step. They are app.yaml, cron.yaml, and php.ini. It is recommended that while you are downloading these files, make sure that you have the latest version of WordPress installed and then extract these files in your hard drive. Now, create a new folder and place the extracted folder and the recently created files there. Name this folder as ‘App Engine‘. Below we have provided the code for all the three files.

File No 1: App.yaml

application: your project ID
version: wpfromstarterproject
runtime: php
api_version: 1
– url: /(.*\.(htm$|html$|css$|js$))
static_files: wordpress/\1
upload: wordpress/.*\.(htm$|html$|css$|js$)
application_readable: true
– url: /wp-content/(.*\.(ico$|jpg$|png$|gif$))
static_files: wordpress/wp-content/\1
upload: wordpress/wp-content/.*\.(ico$|jpg$|png$|gif$)
application_readable: true
– url: /(.*\.(ico$|jpg$|png$|gif$))
static_files: wordpress/\1
upload: wordpress/.*\.(ico$|jpg$|png$|gif$)
– url: /wp-admin/(.+)
script: wordpress/wp-admin/\1
secure: always
– url: /wp-admin/
script: wordpress/wp-admin/index.php
secure: always
– url: /wp-login.php
script: wordpress/wp-login.php
secure: always
– url: /wp-cron.php
script: wordpress/wp-cron.php
login: admin
– url: /xmlrpc.php
script: wordpress/xmlrpc.php
– url: /wp-(.+).php
script: wordpress/wp-\1.php
– url: /(.+)?/?
script: wordpress/index.php

File No 2: Cron.yaml

– description: wordpress cron tasks
url: /wp-cron.php
schedule: every 2 hours

File No 3: Php.ini

google_app_engine.enable_functions = "php_sapi_name, gc_enabled"
allow_url_include = "1"
upload_max_filesize = 8M

Step 3

Using my SQL, run the following command to create a local WordPress database. Here you’ll be  asked to provide a password and after this start entering the MySQL shell after the completion of first command.

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

Step 4

Now, we are done with creating database, next we have to use it to run our WordPress locally. For this, you open your Google App Engine Launcher by navigating to File>Add Existing Application. Here you are required to add that file which your created in the first step. Once you are done with adding the application, the application path, Port, and Admin port will be added here and then click on ‘OK’. After this, click on Browse button of the launcher. Here you will see a window appearing, add the required details such as username and passwordhere and click on Install WordPress. Sign up to this by using the details.

Step 5

In this step, we have to edit our wp_config.php file to connect it with your Cloud SQL instance. For this open your wp_config.php file and start editing the file that reads define (‘DB_HOST’, ‘localhost’) and start editing it with the help of below mentioned code.


if(isset($_SERVER[‘SERVER_SOFTWARE’]) && strpos($_SERVER[‘SERVER_SOFTWARE’],’Google App Engine’) !== false) {
define(‘DB_HOST’, ‘:/cloudsql/YOUR_PROJECT_ID:wordpress’);
define(‘DB_HOST’, ‘localhost’);


Here you have to replace your Project_ID_Name with your Cloud SQL instance ID name. After this save the changes.

Step 6

This is the last step where you have to install the Google App Engine for WordPress. Once you are done with installing the plugin, deploy WordPress via Google App Engine. Once the deployment is complete, log in to WordPress and you’ll see the activation of Google App Engine plugin on your platform. Now, activate the plugin to run WordPress on Google App Engine. It’s done!

To Sum Up

I hope you find the tutorial helpful and easy to follow. Anyone can host their WP site on Google App Engine and see the difference in the performance of their website.