Google App Engine and Wordpress set up error - Win

2020-06-27 01:45发布

I'm trying to set up Google App Engine and Wordpress version 3.8 according to instruction at https://developers.google.com/appengine/articles/wordpress

But when I run $ APP_ENGINE_SDK_PATH/dev_appserver.py APPLICATION_DIRECTORY I have got the error

Unable to assign value 'wordpress/..(htm|html|css|js)$' to attribute 'upload:' value 'wordpress/..(htm|html|css|js)$' for upload does not match expression '^(?:(?!\^).*(?!\$).)$' in app.yaml in line 9, column 11

Here is my app.yaml file's content:

application: thangvmwordpressdemo
version: 1
runtime: php
api_version: 1

handlers:
- 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

Can you have me solve this problem? Thank you so much!

4条回答
ら.Afraid
2楼-- · 2020-06-27 02:13

Also had this problem. You need to download the latest version of the appengine SDK for PHP. It's at 1.9.2 now. You can maintain separate versions if you still need the older version.

查看更多
Animai°情兽
3楼-- · 2020-06-27 02:16

As of 19 Jan 2014 that article doesn´t work with current Google App Engine for PHP SDK v1.8.9 (Windows). The problem is the final regex ending ($) of the handlers.upload attribute. I´m not sure why this has happened and when it will get fixed, however, you can try any of the following workarounds:

You have to either remove it:

handlers:
- url: /.*\.(htm|html|css|js)
  static_files: wordpress/\1
  upload: wordpress/.*\.(htm|html|css|js)
  application_readable: true

or use the semantically equivalent (to the faulty one):

handlers:
- url: /.*\.(htm|html|css|js)
  static_files: wordpress/\1
  upload: wordpress/.*\.(htm$|html$|css$|js$)
  application_readable: true

Cheers !!

查看更多
贼婆χ
4楼-- · 2020-06-27 02:16

+1 to boombatower's comments; you might have better luck using the GitHub "Starter Project" for WordPress that we posted here: https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project

That article is tough to follow because there is such a difference between going through all those steps and just cloining a git project and getting on with it, and it's also updated less frequently because the git project is "crowdsourced" among several Googlers while the article is written by one writer with many other priorities.

Here's the app.yaml file from that project, for comparison: https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/blob/master/app.yaml

查看更多
淡お忘
5楼-- · 2020-06-27 02:30

The documentation was recently update to reflect changes made in the regex validation. The validation is done both by the SDK on the client side and on the server side (app engine). Please make sure you are using the 1.8.9 SDK (current), otherwise regex ending in $ will not work.

查看更多
登录 后发表回答