Reputation: 1800
My application contains Angular and Php Yii2 framework.
I hosted my application on Google App Engine.
Here is the contents of my app.yaml file:
threadsafe: true
runtime: php55
api_version: 2
handlers:
# The root URL (/) is handled by the Go application.
# No other URLs match this pattern.
- url: /(.+)
static_files: \1
upload: (.*)
- url: /web-service/*
script: web-service/yii
- url: /
static_files: index.html
upload: index.html
My Yii2 library is available in web-service directory, but when I call REST API from the postman, it then returns a '404 page not found' error.
Am I missing something in my app.yaml file?
Please help me solve this issue. My API call is something like this:
https://abcxyz.appspot.com/web-service/web/user-registration/login-user
Upvotes: 0
Views: 233
Reputation: 39824
Several problems:
api_version: 2
- there is no such version presently, set it to 1
. From the api_version row in the Syntax table:
At this time, App Engine has one version of the php runtime environment: 1
the order of the handlers in app.yaml
matters, the first one with a matching pattern will be used. Your url: /(.+)
pattern will match all of your /web-service/*
requests as well, so static files uploads will be attempted instead of the script(s) you're expecting. Re-order your handlers with the most significant patterns preceeding the less significant ones.
your script: web-service/yii
entry might not be OK if other php files need to be served from the web-service
dir (the web-service/yii
will always be the one served, regardless of the requested script). Instead I'd use the handler suggested in the Example (assuming the script names always end with .php
):
# Serve php scripts. - url: /(.+\.php)$ script: \1
Always check the request entries in the development server logs as a starting point to debug request failures.
Upvotes: 1