PHP App engine URLs requiring script filename

131 views
Skip to first unread message

Jay-Nicolas Hackleman

unread,
May 30, 2017, 2:54:49 PM5/30/17
to Google App Engine

Hi, I'm new to app engine, and I'm noticing when I develop in localhost: I can hit my scripts with the following:
localhost:8000/my/url?param=value


Which in turn calls the index.php file in the /my/url location with the get parameters of param=value.

But when I deploy to the app engine: it seems to require that I call the file directly:
project-1234.appspot.com/my/url/index.php?param=value

I'm a bit confused as to whether I'm supposed to change something in the app.yaml, or the nginx-app.conf file and how to do that. 


Thanks

George (Cloud Platform Support)

unread,
May 30, 2017, 3:42:05 PM5/30/17
to Google App Engine
Hello Jay-Nicolas, 

All details on how to deploy your PHP app to the app engine can be found in the "Deploying to App Engine" on-line document. To call your app you are advised to use: http://[YOUR_PROJECT_ID].appspot.com

Your handlers are to be listed in the app.yaml file, as described on the "app.yaml Reference" page

If this information is not what you need, or if you'd like more detail, you are welcome to return with more in-depth questions. 

Jay-Nicolas Hackleman

unread,
May 30, 2017, 3:52:22 PM5/30/17
to Google App Engine
Thanks george... I've read all that and I can't seem to figure it out...

I guess I'll just phrase a new question then.

What is the specific configuration of the app.yaml file to permit my google app engine project to function without me having to directly call php file names?

George (Cloud Platform Support)

unread,
May 31, 2017, 11:54:31 AM5/31/17
to Google App Engine
Usually, one uses a script (or more than one, for additional modules) to handle requests. There is no obligation to mention file names. For details, you may check the "Serving Static Files" page

Jay-Nicolas Hackleman

unread,
May 31, 2017, 1:48:40 PM5/31/17
to Google App Engine
I'm a bit confused... so my original question I feel was pretty clear in what I wanted to do...

Are you telling me that it can't be done that way, or are you telling me that you recommend a different approach that routes all traffic through a single script? 

So... this help doc about static files... are you telling me I should look at something specific in it? Why would I want to serve php scripts as static files?

Nicholas (Google Cloud Support)

unread,
May 31, 2017, 2:54:43 PM5/31/17
to Google App Engine
Hi Jay-Nicolas,

From your original post when you mention the nginx-app.conf, I suspect you're using an nginx process to route requests to given PHP scripts.  App Engine uses nginx internally as well but it is not configured using standard nginx conf files that users can access.  Instead, the handlers defined in your app.yaml are used to route requests to given scripts.  The url property is a regular expression that is tested against the URL path of the request.  If it matches, the associated script that this handler points to is called.  Thus the path and script can be entirely different.  There are a few examples shown in the app.yaml reference documentation linked previously.

Are you using dev_appserver.py to test locally?  If so, it should treat your app.yaml handlers the same as when deployed to the production environment and no local nginx process is required.  If you're using dev_appserver.py and the handlers are treated differently than in production, I'd recommend filing a new issue on our Issue Tracker.

Jay-Nicolas Hackleman

unread,
Jun 2, 2017, 5:45:59 PM6/2/17
to Google App Engine
Ok, so after a lot of fooling around: I've ended up creating an entire new app in the Standard Environment instead of the Flexible. At this point: the mod_rewrite tutorial actually worked - of course once I got to the end of the tutorial it basically said I didn't need to do it... lol.

Regardless: performing the same handler redirects in the flex environment didn't seem to work. 

I still didn't get it to just work the way I'm used to, but I've managed to deploy a working solution.

Thanks

Jay-Nicolas Hackleman

unread,
Jun 2, 2017, 5:47:26 PM6/2/17
to Google App Engine
I should mention as well: I started in Standard because the dev_appserver.py functionality is not supported in flex either. It seems like there are just too many differences here for my newbie brain to be able to handle. Standard Env also deploys in a fraction of the time.

George (Cloud Platform Support)

unread,
Jun 5, 2017, 9:38:58 AM6/5/17
to Google App Engine
Hello Jay-Nicolas, 

It may add value to the present discussion if you summarize in your own words the difficulties encountered and the way you overcame them. This way, other people will benefit more. 

You have mentioned once that you expect things the way you are used. How are you used exactly? This usage seems to contradict your own description as a "newbie". In short: what environment were you used to and how does the app engine differ from, it? Is this in good ways or bad? Any suggestions towards improvements from a newbie point of view? 
Reply all
Reply to author
Forward
0 new messages