blueKingdom11
blueKingdom11

Reputation: 103

How to write app.yaml file for PHP application

I am currently working on a PHP Web application for GAE using Cloud SQL as well. I have problems when deploying the PHP App to GAE.

The ERROR message is "Error: Not FoundThe requested URL / was not found on this server.".

I tried to follow some sample app.yaml files, none work. The application works perfectly fine in my local. I suspect I wrote the app.yaml, I am new to the .yaml file and whole google app engine, please help.

I tried with

handlers:
  url: .*
  script: index.php and it gives me too many redirects error.

I changed to script: login-view.php (my login page instead) the login page shows but I am unable to login as it does not authenticate properly.

runtime: php55
api_version: 1
threadsafe: true

handlers:
- url: /
  script: login-view.php

- url: /.*
  script: index.php

env_variables:
    MYSQL_DSN: "mysql:unix_socket=/cloudsql/<instance name>;dbname=<dbname>"
    MYSQL_USER: "username"
    MYSQL_PASSWORD: "password"

beta_settings:
    cloud_sql_instances: "<instance name>"

When I launch my browser:

Able to launch the login page but now login-view.php error 

 appspot.com redirected you too many times.
 Try clearing your cookies.
 ERR_TOO_MANY_REDIRECTS

Upvotes: 0

Views: 2049

Answers (1)

blueKingdom11
blueKingdom11

Reputation: 103

After several trial and errors this worked for multiple .php pages

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

- url: /.*
  script: index.php

Upvotes: 3

Related Questions