Search code examples
google-app-enginegoogle-cloud-sql

Having issues getting WordPress running under GAE + Cloud SQL


I tried to set up WordPress under Google App Engine earlier tonight (following the instructions here: https://developers.google.com/appengine/articles/wordpress).

It runs fine locally, but when I push to remote I get a database error (visible at https://wp-dot-frontiermediag.appspot.com/). If we throw on a /wp_admin/install.php you get:

This either means that the username and password information in your 
wp-config.php file is incorrect or we can't contact the database server 
at :/cloudsql/frontiermediag:fmwp. This could mean your host's database 
server is down.

Here's the relevant code in wp-config:

/** MySQL hostname */
if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
define('DB_HOST', ':/cloudsql/frontiermediag:fmwp');
}else{
  define('DB_HOST', 'localhost');
}

frontiermediag:fmwp is showing "Status Runnable" in Developers Console > Cloud SQL.

I did this once before and it worked so I'm not sure what I'm missing here. I thought it might have been because I'm using WP 3.8.1. but rolled back to 3.5.1 and same thing's happening.

Any ideas? frontiermediag is listed as an authorized application on the :fmwp ACL.


Solution

  • This situation happened to me earlier.However, I edited my Cloud SQL instance , and set "Preferred Location" as "Follow App Engine App" from Google Developers Console. This database connection problem was solved in my case.