Trouble running local WordPress in Google App Engine (27 posts)

  1. OC2PS
    Posted 2 years ago #

    Following these instructions: https://developers.google.com/appengine/articles/wordpress

    Installed MySQL, Python and Google App Engine PHP SDK on a Windows 8 PC. Perfect!

    Created an app for WordPress, created database and user on localhost and edited WordPress config accordingly.

    Started the app in the Google App Engine Launcher. Clicking Browse leads to blank page at http://localhost:8080/


    Checked logs, found

    2013-11-26 17:56:18 Running command: "['C:\\Python27\\python.exe',
    'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py',
    '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000',
    INFO     2013-11-26 17:56:19,805 devappserver2.py:660]
    Skipping SDK update check.
    WARNING  2013-11-26 17:56:19,813 api_server.py:331]
    Could not initialize images API; you are likely missing the Python "PIL" module.
    INFO     2013-11-26 17:56:19,822 api_server.py:138]
    Starting API server at: http://localhost:53853
    INFO     2013-11-26 17:56:19,826 dispatcher.py:171]
    Starting module "default" running at: http://localhost:8080
    INFO     2013-11-26 17:56:19,828 admin_server.py:117]
    Starting admin server at: http://localhost:8000
    INFO     2013-11-26 17:56:21,828 module.py:617] default: "GET / HTTP/1.1" 302 -

    Pretty certain the Python for Windows package I used included PIL. Besides, that "shouldn't" matter.

    Even more troublingly, the last line of the log output is a HTTP redirect from / to another page...the output appears to have been interrupted.

    Not sure where to go from here...

  2. OC2PS
    Posted 2 years ago #

    If I go to http://localhost:8080/wp-admin/ though, I get

    Warning: chdir(): Invalid argument (errno 22) in C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\php\setup.php on line 42
    Warning: require(wordpress/wp-admin/wp-admin/install.php): failed to open stream: No such file or directory in C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\php\setup.php on line 103
    Fatal error: require(): Failed opening required 'wordpress/wp-admin/wp-admin/install.php' (include_path='C:\Users\CsillamVilag\Documents\development-appengine\arcfestesmintak;C:\Program Files (x86)\Google\google_appengine\php\sdk') in C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\php\setup.php on line 103
  3. Catalyx
    Posted 2 years ago #


    It seems we've reached the same point where the initial WP page should display. Yours is blank and mine displays the infamous "Error establishing a database connection".

    Though this may not prove helpful in your case, my experience is that installing PIL hasn't changed the results. If you still want to give it a go, Google has instructions here.

    It seems you've set up the local database correctly for WP and GAE. I want to ask what parameters you used. I used precisely the ones on the GAE-WP setup page for wp-config:

    /** The name of the database for WordPress */
    define('DB_NAME', '**wordpress_db**');
    /** MySQL database username */
    define('DB_USER', '**wp_user**');
    /** MySQL database password */
    define('DB_PASSWORD', '**wp_password**');

    I'm not sure if the wildcards, "**", are interfering but altering removing these wildcards in wp_config, I either get confirmation that wp_user logs into MySQL but the database "wordpress_db" cannot be found or vice-versa, the database can be found but the wp_user cannot gain access.

    Can you confirm or print a copy of your block of code in wp_config dealing with these four parameters, if you did not change them to something else?


  4. OC2PS
    Posted 2 years ago #

    Using Google's parameters indeed results in Error Establishing Database connection.

    Removing the "**" leads me to the blank page. I am using my own database name, username and password as well now. And that leads to blank page too.

  5. OC2PS
    Posted 2 years ago #

    In the error returned at http://localhost:8080/wp-admin/ I see
    Obviously install.php cant be found. It is in /wp-admin/ not in /wp-admin/wp-admin/
    Not sure how to fix that.

  6. Catalyx
    Posted 2 years ago #

    Thanks for responding. It seems that the GAE instructions have some inconsistencies. I got clarified that what I thought were wildcards, "**", are indeed placeholders for the variables.

    I'm now dealing with the blank screen issue you're having. I've noticed that the command line result of executing the dev_appserver.py script displays:

    File "C:\google_appengine_1.8.3\google_appengine\google\appengine\api\logservice\logservice_stub.py", line 153, in start_request
    host, start_time, method, resource, http_version))
    IntegrityError: RequestLogs.module may not be NULL

    I've installed GAE Launcher v1.8.8 but all references to the "IntegrityError" relate to reverting to v1.8.7.

    I'll report if I resolve the blank screen error. I'll otherwise have to start from scratch.

  7. Catalyx
    Posted 2 years ago #

    @OC2PS, to resolve the browser blank screen and the command line errors, I downgraded WP to v.3.5.1; the GAE-WP instructions state this is the version used while you have v3.7.1, per your query here.

    Once you do this, go to http://localhost:8080 and NOT http://localhost:8080/wp-admin. GAE will automatically forward your browser to http://localhost:8080/wp-admin/install.php and there the WP installation screen should appear.

    I hope this helps.

  8. OC2PS
    Posted 2 years ago #

    Downgrading WordPress from 3.7.1 to 3.5.1 did make it work.

    On one hand I am glad that it's working now, on the other hand this sucks! WordPress' latest version should work on Google Apps Engine. Especially now that WordPress have decided that they will start automatically updating your installation for you!

  9. Catalyx
    Posted 2 years ago #

    Good stuff. I believe the tutorial notes that GAE is just for production, at least for PHP. Admin can upgrade from the local server, install plugins and deploy the app. Admin cannot do either from the production server or, at least, I haven't been able to.

    (If you're attempting a migration including content from another production server as I am, you will likely have to set everything up locally and then deploy onto GAE.)

    Last question on the database, and a possible answer to a problem you may run into if you haven't yet:

    The preset SQL script in Step 6 uses the same parameters as my first post above--wp_user, wordpress_db and wp_password. If you already deployed your v3.5.1 app, were you able to customize these parameters and have the app connect to the database?

  10. OC2PS
    Posted 2 years ago #

    I haven't deployed yet, but the custom parameters do work for me locally. Will report back once I get a minute to deploy (in a day or two)

  11. VenturaVan
    Posted 2 years ago #

    I am tearing my hair out. It works fine for me locally and no errors on deploy. I am using WP 3.5.1 but getting the dreaded "Error establishing a database connection" and I have no idea why. I even used my desktop MySQL workbench to attach to the Google SQL Cloud database and created my user and GRANT ALL renotel, but STILL get the "Error establishing a database connection". :-(

    What do I do next?

  12. fredhead
    Posted 2 years ago #

    OC2PS do let us know how deploy turns out. I'm able to run 3.7.1 locally but I have to remove the ** fore/aft from the DB_NAME, DB_USER, DB_PASSWORD values to work. It's unclear from you guys above if this is okay (which is why I'm curious to hear if your deploy works).

    Another wrinkle alluded to by Catalyx is importing production data, including hard-coded URLs and paths in the wp_options table. I wonder what these values should be changed to so they work locally and remotely on GAE? My /wp-admin login process naturally throws me to my live production site URL.

    At the least, thanks for this thread guys. It helped move me along.

  13. OC2PS
    Posted 2 years ago #

    The ** are definitely stupid. They are so out of place in a documentation page that seems otherwise well-written.

    I am still far from deployment. As I am not based in the US, herefore I haven't yet been able to set up my Cloud SQL instance. (returns the error that cloud SQL and app must be in same region...)

  14. Catalyx
    Posted 2 years ago #

    @VenturaVan: you likely have customized your database name, user or password. GAE doesn't allow for their alterations. With the exception of removing the asterisks, i.e. "**", from the MySQL script, there should be nothing else changed.

    This isn't explained in the tutorial but implicit in further steps as it seems the SQL script to connect the site to the database is fixed and cannot be altered. Why and isn't this a security risk? Authentication is set locally. The tutorial further explains that Google provides the security.

    @fredhead: yes, the "**" in the instructions must be removed. I migrated my data and deployed with little problem, save the usual broken links and pages here and there in migrations. I didn't have to individual changes to specific DB tables; I just made global changes to the URLs. If you're being directed to your live site, check your "hosts" file that you have " localhost" listed without being commented out.

    Contrary to what I wrote above, you can go directly to http://localhost:8080/wp-admin or http://localhost:8080/wp-admin/install.php after deployment or save the extra keystrokes and just type http://localhost:8080.

    @OC2PS: in the Google Cloud service account, I believe you can select where to have your preferred geographic presence for the site. It seems and the DB may need to be the same.

    I'm new to GAE and hope this helps.


    Separately, GAE is pretty powerful and fast loading once live. The problem I, and it seems others, have had is the speed of the local server. Searching the web for "app engine localhost slow" shows many others have reported this problem with database and page timeouts. This is a problem since all GAE development must be done locally. If someone else successfully deploys, let me know how is your localhost speed. I may start a separate thread for this but thought I'd quickly ask.

  15. VenturaVan
    Posted 2 years ago #

    I fixed my database problem. I had my hostname as the xxx.appspot.com instead of localhost. When I changed it to localhost it worked.

    Now facing another issue. Can't activate plugins even though I just creatd a bucket (the instructions are backwords. We should create Cloud buckets FIRST to be less confusing) and set up a new user with the app email name with permission (OWNER). Still can't activate plugins because it still asks for FTP user info!!!

  16. fredhead
    Posted 2 years ago #

    @Catalyx Thanks for the extra details. FWIW I'm getting routed to my current URL because I imported my current database which includes the Settings > General values for URLs. So all the links use those values. Today I plan to test with a fresh install then do a db dump after I deploy to see if anything changes with those values, then adjust my current database values and repeat the import and deploy. Worst case, I'll use a test domain I have, get stuff working, then repoint my domain and adjust the Settings > General values in WP.

    I'm also wondering about SSL. Otherwise, GAE seems like it has really evolved nicely beyond an enterprise or hobby option. Appreciate your help and @OC2PS's details.

  17. VenturaVan
    Posted 2 years ago #

    Ooops..I see I was supposed to install the plugins LOCALLY first. I didnt do that. Will do that later today and re-deploy.

  18. VenturaVan
    Posted 2 years ago #

    Okay, I "think" I am up and running. But just went to change my permlinks structure and it says I can't write to my .htaccess file. How do I access that?

    On a sidee note: do they (google appspot.com) expect us to do all of our configurations locally and then upload? If so how would the database stuff get transferred? Anyway, that would be ridiculous if i\we have to do everything locally and then upload.

  19. VenturaVan
    Posted 2 years ago #

    I guess my answer for the above question is how do we obtain ftp access to our site?

  20. Catalyx
    Posted 2 years ago #

    @VenturaVan: your .htaccess file, when it's present, is most often at the root of your WP installation; e.g. "htdocs\wordpress\" under most localhosts settings. If you have the standard WP installation though, you seldom have to change the admin user's, in this case you and the WordPress application, permissions for the file when building a basic website.

    I would recommend searching the web or starting a new thread to troubleshoot the issue.

    Yes, GAE is only for production and so all development, including installing plugins, themes and making modifications that would require FTP. You can update WP versions and plugins though once installed. In short, GAE does not yet support FTP as far as I know.

    Hope this helps.

  21. VenturaVan
    Posted 2 years ago #

    @Catalyx: So what you are saying is I have to do any changes that affect .htaccess LOCALLY and then Deploy? Seems VERY unreasonable to me, not to mention fraught with danger (possibility of post deploy (production) not liking changes I made locally)

  22. pevans
    Posted 2 years ago #

    @VenturaVan: I am at the same point you were above. Everything works great locally and I can deploy without any errors. However when I try to access the site via App Engine, I get "Error Establishing a Database Connection". What did you mean above when you said:

    I had my hostname as the xxx.appspot.com instead of localhost. When I changed it to localhost it worked.

    Any additional info is greatly appreciated.

  23. OC2PS
    Posted 2 years ago #

    @OC2PS: in the Google Cloud service account, I believe you can select where to have your preferred geographic presence for the site.

    I wish it were that simple. It's not. If you are outside the US, you can't choose the location of your app in a free account. You need to apply for a Premium account (which I did 10 days ago). And then you need to wait (as I am still) for them to convert your account.

    I downgraded WP to v.3.5.1; the GAE-WP instructions state this is the version used while you have v3.7.1, per your query here.

    Thank you for bring this issue to our attention. The bug surfaces due to a change in WordPress 3.7 and affects only the development server. It should be fixed in the next release. Meanwhile, please manually change line 109 -110 of <google_appengine root>/google/appengine/tools/devappserver2/php/runtime.py from

    user_environ['REAL_SCRIPT_FILENAME'] = environ[ http_runtime_constants.SCRIPT_HEADER]


    user_environ['REAL_SCRIPT_FILENAME'] = os.path.normpath( os.path.join(self.config.application_root, environ[http_runtime_constants.SCRIPT_HEADER]))

    As this is a Python script, make sure the new statement is indented correctly.

  24. buzzingbubs
    Posted 2 years ago #

    I have followed the instructions on this page to the 'T'

    The everything seems to be working fine locally but it's not working in production.

    After deployment when I try accessing buzzingbubsindia.appspot.com it redirects to http://buzzingbubsindia.appspot.com/wordpress/wp-admin/install.php where I get a 'too many redirects' error message.

    Has anyone else faced this issue?

  25. appbitcloud
    Posted 2 years ago #


    I'm having the exact problem as you.
    WP works locally but after deployment, it fails over there and go on redirect loop.

    I asked at the Stackoverflow forum and still got no response.

    Anyone got the same thing?
    I'm using the latest WP 3.9

  26. boboglas
    Posted 2 years ago #

    Hi guys
    I have exact problem as you.
    I have some error message on my http://womensportsbra.myprlblogs.info
    need help

  27. Leland Riordan
    Posted 2 years ago #

    The main tutorial is really outdated and hasn't worked in months. You guys should check out the WordPress App Engine Starter Project on Github. It is maintained by Googlers and they seem to update it fairly frequently and respond to issues/pull requests (albeit slowly). On Windows I had to move the files in step one of the readme manually but I was able to get it running both locally and on App Engine successfully following the provided instructions.

    That being said there are a few problems with running WordPress on app angine that I have encountered and can't seem to fix. For example, if you want to use a custom domain, SSL is required to login to the WordPress Admin by the App Engine WP plugin. A workaround is to only edit your site via the (app_id).appspot.com domain that is provided by App Engine because it has SSL enabled. Another problem I have encountered is certain plugins like Jetpack, seem to not work with custom domains correctly even when set in the admin. Jetpack confuses the provided domain (app_id).appspot.com domain with my custom domain. I have not tried it with very many plugins but something is definitely not working correctly. It also seems like WordPress SEO by Yoast has similar problems.

    I have been messing around with settings for months now trying to get them perfect to no avail. Performance is not the problem. WP runs ridiculously fast if you set up Warm up requests in app.yaml, tweak the Perfomance section of the App Engine Console "Application Settings" page, and enable Pagespeed service.

    The problem is its simply not practical to run WP on it until plugins work how they should and custom domains don't cause problems. Its definitely not ready for big production WordPress installs at this time.

    Personally, I made the switch to AWS's Elastic Beanstalk until Google works out the kinks. It has similar speeds, similar price and none of the weird problems.

Topic Closed

This topic has been closed to new replies.

About this Topic