In my GAE PHP app.yaml i am trying to do this:
application: myapp
version: 1
runtime: php
api_version: 1
threadsafe: yes
handlers:
- url: /sitemap.xml
static_files: sitemap.xml
upload: /sitemap\.xml
- url: /MyOneLink
script: /myDynamicContent.php?myparam=hardcoded_value_1
- url: /MySecondLink
script: /myDynamicContent.php?myparam=hardcoded_value_2
so one can browse http://example.com/MyOneLink and get the result of the dynamic php (which depends of the hardcoded myparam value)
the problem is that when browsing, nothing is shown. any idea ?
btw: you can figure out why i am also publishing a "sitemap.xml": it will be used to expose all myLinks
thanks diego
You cannot pass parameters in the "script:" parameter.
One way to fix this would be two have two "entry" scripts, which then include your main script, like this:
Which you can then reference in app.yaml
This is probably the quickest way to make your existing code work (although there are better ways to do it).
The other answers would be fine for a finite number of values that are hardcoded (as shown in question).
But if you want to work with a truly dynamic version with infinite possibilities of values, you may think of the following (does not work):
The above does not work. You can workaround the problem by using a simple PHP hack.
Update the
app.yaml
to:In
myDynamicContent.php
, get the value of$_SERVER['REQUEST_URI']
and parse this string to get the intended value formyparam
.Update! More elegant method:
Original clunkier method:
Tip: You can use single quotes
'
instead of double quotes"
reading the oficial doc https://cloud.google.com/appengine/docs/php/config/mod_rewrite i did this: