500 Error when Migrating Wordpress to Google Cloud

2019-09-01 15:00发布

Yesterday I spent my Sunday (almost) migrating my Wordpress install to Google Cloud following their wordpress setup tutorial. I've not come to the point that I need help, I've got caught up by 500 errors when test submitting the subscribe form: http://v-sons.appspot.com/wtf/#subscribe

Being new to GCE I don't really know how it works, but I managed to work out some other 404 errors when I migrated fonts and videos over because I needed to include the filetypes in the app.yaml. I added:

- url: /wp-content/(.*\.(eot|svg|ttf|woff))$
  static_files: wordpress/wp-content/\1
  upload: wordpress/wp-content/.*\.(eot|svg|ttf|woff)$
  application_readable: true

- url: /wp-content/(.*\.(mp4|ogv|webm))$
  static_files: wordpress/wp-content/\1
  upload: wordpress/wp-content/.*\.(mp4|ogv|webm)$
  application_readable: true

Back to the subscribe.php script. It definitely works because it is still running on the old server as the live version of the site over here - https://vsons.co.uk

As I mentioned, I don't fully understand what Google is doing with the other files, but in the app.yaml it seems to set the upload to static. As subscribe.php is a script I wondered whether it needs to set as one in the yaml. e.g.

- url: wp-content/themes/vrn/.*
  script: subscribe.php

There is also no mention of php in the app.yaml, so the fileformat hasn't been defined apart from at runtime: php. Having said that, obviously wp is built in php and everything else seems to be loading fine. If anyone could shed some light on why I'm seeing the 500 error and what GoogleApp Engine Launcher might be doing with my code that'd help me out no end!

I hope the question is thorough enough!

1条回答
唯我独甜
2楼-- · 2019-09-01 15:11

As an update to anyone experiencing the same problem. I used the logs (thanks @Shaunak) to work out that the problem was with the curl_init() function, and that Google App Engine doesn't support it, so I went in search of an alternative.

Thanks to a solution posted on another thread - Replacing CURL with urlfetch in PHP, I was able to find that url_fetch() was the Google equivalent, however with no experience of writing this sort of code it was going to be difficult. Further down the thread however, @user3275764 drew my attention to this awesome library: https://github.com/azayarni/purl which essentially allowed me to use my existing code without any further problems, it just needed an include.

I'm sure this is probably quite a commonly faced problem with App Engine, so I'm surprised I couldn't work it out, but thanks for all your comments and help along the way!

Rufus

查看更多
登录 后发表回答