0

I have the following directory structure:

/www
  - index.html
  - signUp.html
  - submitEmail.php

And then above this:

/www
app.yaml

Here's my app.yaml file:

runtime: php55
api_version: 1
threadsafe: true

handlers:
- url: /(.+\.php)$
script: www/\1

- url: /
static_files: www/index.html
upload: www/index.html

- url: /(.*)
static_files: www/\1
upload: www/(.*)

When I click my submit form button I receive the following error:

No web page was found for the web address: https://<url>/submitEmail.php HTTP ERROR 404

Here's the form file:

<form class='email_form' action="/www/submitEmail.php" method="post">
            <input class='input_email' id='limitedInput' type="text" name="email" placeholder="Email" autofocus>
            <br>
            <input type='text'>
</form>

I've been trying for hours to get this going but for some reason don't seem to be. Any help would be great thanks :)

Joan Grau Noël
  • 3,084
  • 12
  • 21
Hews
  • 569
  • 6
  • 19

1 Answers1

0

The culprit was incorrect handlers in app.yaml. This works:

handlers:
- url: /(.+\.php)$
script: www/\1

- url: /
script: www/index.html

- url: /(.*)
script: www/\1

I think the static_file declaration screwed up the web-server. Unfortunately not versed enough to explain exactly why but hopefully this leads people in the right direction.

Hews
  • 569
  • 6
  • 19
  • Hi Hews, just to clarify what happens with the `static_file` filed. When you include this field, you're telling App Engine to serve the file as a resource that don't contain dynamic components, such as non dynamic HTML files, images, CSS etc. App Engine offers a separate set of servers dedicated to deliver static files that are optimized to handle request for static resources. That's why it didn't work for `submitEmail.php`. – dhauptman Feb 01 '19 at 13:21
  • Hey @dhauptman - I may have spoken prematurely. Having a set of other issues at the moment. Currently experiencing this issue https://stackoverflow.com/questions/54479810/php-parse-error-syntax-error-unexpected-y9gg-t-string-suddenly-appearin?noredirect=1#comment95767903_54479810 – Hews Feb 01 '19 at 13:30