Home > Net >  Google App Engine Deployment Issue When Switching Environments
Google App Engine Deployment Issue When Switching Environments

Time:12-13

When I have my app.yaml file set to deploy in a flex environment everything works great.

runtime: php
env: flex

runtime_config:
  document_root: web

When I change the app.yaml file to deploy in a standard environment I get a 500 server error.

runtime: php74
env: standard

runtime_config:
  document_root: web

Does the yaml file require additional parameters when running a standard environment?

enter image description here

See below for answer.

CodePudding user response:

The app.yaml docs for PHP5 & PHP7 do not list an entry for runtime_config for PHP Standard Env

If you look at the official samples for the hello world application, you'll notice only the flex env has it. The standard does not have it

CodePudding user response:

For a standard environment https://cloud.google.com/appengine/docs/standard/php7/runtime states: You will need to deploy a front controller to handle all request routing. If your app contains a public/index.php or index.php file, App Engine uses this file to serve your app.

This reads, to me, as "if you have an index.php in your root regardless of directory it'll work without having to define an entrypoint in your app.yaml file", but this isn't the case.

If your file structure is app>public>index.php and you want to use index.php as your front end controller then you do not have to define an entrypoint in your app.yaml file.

If your file structure is app>web>index.php, like my example above, and you want to use index.php as your entrypoint/controller you have to add entrypoint: serve web/index.php to your app.yaml file or if you want to use controller.php you would have to add entrypoint: serve web/controller.php respectively.

Seems to me it would be best practice to just manually define your entrypoint even if you use the standard public/index.php structure.

runtime: php74
env: standard
entrypoint: serve public/index.php
  • Related