I deploy static files (html,css, js) and working good at gae but for php files gives 404 error

474 views Asked by At

My app.yaml as:

 runtime: php55
 api_version: 1
 threadsafe: true

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

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

as seen above static files are under www dir. and php files are under the vendor dir and its sub sirs. I have read all days doc. to understand this yaml file to able to understand but unfortunately not yet :) . So, html and all static files works perfect. but when ajax calls php with sending data to php. gives 404 error. It works good on local wamp server. main opening page is index.html under www . And its ok. All day I tested many variant to able to deploy php files. Not able yet.

mainProjectRoot>app.yaml ( only this file and two directory "www and vendor")
                www/index.html
                   /css
                   /js
                vendor/smsgonder.php
                      /mail.php
                      /../../more php files

At least I gave up to try more variant and I need help to set up app.yaml page. (except above variant all extra code I received always error and no deployment) Any help will be much appretiated. Thanks in advance !

final app.yaml is

runtime: php55
api_version: 2
threadsafe: true

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

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

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

enter image description here

EDIT this is final app.yaml ... (for a while I have deployed php files and some are were woring . But again for some php I receive "POST 500 error " in case I like to share final app.yaml file here.

runtime: php55
api_version: 2
threadsafe: true

handlers:
- url: /(.*).php 
  script: \1.php

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

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

Any help will be very much appreciated. How could be :)) I spent 5-6 days just for deploying finished app :)'

2

There are 2 answers

6
user7180 On

add this immediately after handlers:

- url: /(.*)\.php$
  script: vendor/\1.php

This will serve all request ending with .php to the php files within the vendor folder

9
Dan Cornilescu On

The handlers section for PHP scripts following the documentation Example (works for vendor subdirectories as well):

# Serve php scripts.
- url: /(.+\.php)$
  script: \1

Note: indentation matters!