Create Yii2 basic application for deploy on Google App Engine (Flex Environment)
Flex Environment allows read and write on the directory sys_get_temp_dir()
, which allows Yii2 to use the runtime folder
However, static assets are uploaded into Google Storage for public access
(Advance branch adds local environment support and pretty url)
Instruction for advance branch : https://github.com/oitmain-public/yii2-app-gae-flex/blob/advanced/README.md
Storage Object Viewer to allUsers
$ echo '[{"origin": ["*"],"responseHeader": ["Content-Type"],"method": ["GET", "HEAD"],"maxAgeSeconds": 3600}]' > cors-config.json \
&& gsutil cors set cors-config.json gs://<your-bucket-name>
Clone project and install composer requirements
$ git clone https://github.com/oitmain-public/yii2-app-gae-flex
$ # For Advanced app, clone following branch instead
$ # git clone -b advanced https://github.com/oitmain-public/yii2-app-gae-flex
$ cd yii2-app-gae-flex
$ composer install
Copy and update configuration files
$ cp app.yaml.dist app.yaml
Update config/web.php
assetsManager
and cookieValidationKey
$ php -S localhost:8080 -t web/
See https://cloud.google.com/appengine/docs/flexible/php/testing-and-deploying-your-app
$ gcloud app deploy —version [YOUR_VERSION_ID] —no-promote —project [YOUR_PROJECT_ID]
app\models\PhpErrorHandler
to see the actual error without calling the error view