My app is just two files: index.php and app.yaml in the same directory. I keep getting an error every time I try to deploy the application to App Engine.
Asked
Active
Viewed 246 times
-1
-
1That isn't a useful error, is it? Please confirm that you're using App Engine flexible (not standard)? When you say "Hello World", is it the Google tutorial (https://github.com/GoogleCloudPlatform/php-docs-samples)? Have you enabled billing? Please try running the `gcloud app deploy --verbosity=debug` – DazWilkin Dec 12 '21 at 16:44
-
Daz, my application is just an index.php file with "echo hello world" in it, and an app.yaml file with runtime: php env: flex runtime_config: document_root: / If I change document_root to anything else or leave it blank it gives me an error. – Mickey Dec 12 '21 at 17:02
-
App Engine expects the app to be a web server. It expects to receive a container that listens on port `8080`and supports HTTP. You won't be able to deploy just `echo hello world`. Have a look at the Hello World example I included. Perhaps try that? – DazWilkin Dec 12 '21 at 17:26
-
My app is not a web server. So the issue was with my app.yaml file. Apparently you can't have it in the same dir as your app so I did this: client > app > web > index.php + client > app > app.yaml and in app.yaml I changed it to document_web: web - Everything works and the website is functioning correctly now. – Mickey Dec 12 '21 at 18:50
-
Post your solution with explanations as an answer to help others with similar problems. – John Hanley Dec 12 '21 at 18:57
-
@JohnHanley I did, thanks. – Mickey Dec 12 '21 at 20:04
-
Where did you post the answer? Do not post the solution in the question, post an answer. – John Hanley Dec 12 '21 at 20:07
-
John, my apologies. I've been out of the loop. – Mickey Dec 12 '21 at 20:41
1 Answers
1
Your file structure has to be a certain way.
- [folder1/] <directory you gcloud init from
- [folder1/web/] <where your index.php file is
- [folder1/app.yaml] <your app.yaml file should be in the main "folder1" directory
index.php
<?php echo "hello world"; ?>
app.yaml
runtime: php
env: flex
runtime_config:
document_root: web
Maybe this isn't correct but it's the only way I could make it work.

Mickey
- 2,285
- 6
- 26
- 37