kip2
kip2

Reputation: 6863

How to Run Wordpress Blog on Google App Engine Locally

Following the Wordpress on GAE tutorial, I have managed to successfully deploy my blog to App Engine.

However, I would like to be able to run my blog locally as I continue its development, so that I can inspect error logs, etc. Using the GAE dev server, I try to run it like so:

dev_appserver.py --log_level=debug app.yaml --php_executable_path=/usr/local/bin/php

But I run into this problem:

The url "/" does not match any handlers.

I have not changed my app.yaml nor any other file (the ones auto-created by the wp-gae.php step in the tutorial). It looks like this:

# App Engine runtime configuration
runtime: php72

# Defaults to "serve index.php" and "serve public/index.php". Can be used to
# serve a custom PHP front controller (e.g. "serve backend/index.php") or to
# run a long-running PHP script as a worker process (e.g. "php worker.php").
entrypoint: serve gae-app.php

service: test-wp

# Defines static handlers to serve WordPress assets
handlers:
- url: /(.*\.(htm|html|css|js))
  static_files: \1
  upload: .*\.(htm|html|css|js)$

- url: /wp-content/(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))
  static_files: wp-content/\1
  upload: wp-content/.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$

- url: /(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))
  static_files: \1
  upload: .*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$

- url: /wp-includes/images/media/(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))
  static_files: wp-includes/images/media/\1
  upload: wp-includes/images/media/.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$

Any ideas on how I can:

  1. fix the URL error above?
  2. enable debug logs to show up on my console? I just get INFO 2019-05-29 10:58:02,913 module.py:861] test-wp: "GET / HTTP/1.1" 404 - I've tried both the flags --log_level=debug and --dev_appserver_log_level=debug as suggested here and echo nor syslog(LOG_DEBUG,'test') print statements are not working as expected. On my wp-config.php, I have: define('WP_DEBUG', !$onGae);

Upvotes: 0

Views: 413

Answers (2)

Matt
Matt

Reputation: 23

I took couldn't figure out how to get this to work. Unrelated to the logging response, I came across this post: https://introvertedengineer.com/2017/02/20/appengine-and-wordpress-guide/

Which spelled out how the using GAE might not be the best approach:

The big elephant in the room when dealing with App Engine is that your application does not have access to a file system. What does this mean? Well, you can’t autoupdate WordPress, you can’t install plugins, you can’t install themes, etc. If you’re used to being able to do these things via the WordPress admin, you’re going to be disappointed. Like all things, however, there is a workaround!

I first attempted to just run the local Google App Engine SDK and start up my App Engine application that way. Turns out, however, that locally you still don’t have file system access—yeah, even on localhost! So you’ll need to run a local FTP server and then have WordPress make changes via FTP instead of directly on the filesystem. When you’re done with your local changes, you can use Google’s SDK to deploy a new version of your app up to your production instance.

The write up is a little outdated since GAE now supports PHP 7, but the file system aspect still seems to be true (would love to be proven wrong).

I ultimately used MAMP to run wordpress locally (https://www.mamp.info/en/), which was an extra workaround, but got through it.

Upvotes: 0

Osborne Omuya
Osborne Omuya

Reputation: 1

logs viewer from stackdriver logging has logs https://console.cloud.google.com/logs/viewer? the logs include your localhost logs

Upvotes: 0

Related Questions