1

I have deployed my web app - a php app in google app engine. App.yaml code

runtime: php55
api_version: 1
#threadsafe: true

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

- url: /mail
  static_dir: www/mail
# Serve php scripts.
- url: /mail/.*
  script: www/mail/mailsender_1.php
- url: /(.*)$
  static_files: www/\1
  upload: www/(.*)

However, when /mail/mailsender_1.php is called from javascript - ajax call, it does not recognize mailsender_1.php as php script. I have spent a complete day on debugging. Any help would be appreciated.

Cool Coder
  • 309
  • 2
  • 11
  • 1
    By looking at your issue and comparing with this [community question](https://stackoverflow.com/questions/46917832/app-engine-yaml-file-not-running-scripts), it occured to me that the issue might be the final handler, not the `/mail/.*` one. The accepted answer suggest that the final handler is making the deploy think that all files in your `www/` directory are static and uploadable, including `.php` scripts. My suggestion would be to change the `upload: www/(.*)` directive to `upload: www/(.*)\.jpg` or any other file extention you have to give it a try. Try it and let me know if it works. – Ralemos Apr 17 '20 at 14:54
  • Thank you for the pointer and I could able to change my app.yaml file runtime: php55 api_version: 1 #threadsafe: true handlers: - url: / static_files: www/index.html upload: www/index.html # Serve php scripts. - url: /mail/.* script: www/mail/mailsender_1.php - url: /(.*)$ static_files: www/\1 upload: www/(.*)\.(js|css|png|jpg|jpeg|map|woff) – Cool Coder Apr 17 '20 at 18:20
  • So it did work? I will add all that to a proper answer so that the community can see that the issue is fixed, and so that you can accept/upvote it, if it is the case. – Ralemos Apr 20 '20 at 09:21
  • Please consider accepting and upvoting the answer provided below so the community can see that you've been sufficiently helped. – Ralemos Apr 24 '20 at 13:36

1 Answers1

1

By looking at your issue and comparing with this community question, it occured to me that the issue you are facing is due the /(.*)$ handler, not the /mail/.* one.

The accepted answer on that post suggest that your /(.*)$ handler is making the deploy think that all files in your www/ directory are static and uploadable, including .php scripts.

My suggestion would be to change the upload: www/(.*) directive to upload: www/(.*)\.(js|css|png|jpg|jpeg|map|woff) as it will suit all file extention you have, according to the comments.

So your handler section should look like this:

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

- url: /mail
  static_dir: www/mail
# Serve php scripts.
- url: /mail/.*
  script: www/mail/mailsender_1.php
- url: /(.*)$
  static_files: www/\1
  upload: www/(.*)\.(js|css|png|jpg|jpeg|map|woff)
Ralemos
  • 5,571
  • 2
  • 9
  • 18