I have a ready php website. For that website I am writing app.yaml for google app engine.
I read so many answers but it doesnt help me.
I am facing problem with php files under various subfolders in libraries folder.
In index.php, i accept rss feed url and process it for full text feed by calling other php files. but getting this error.
/makefulltextfeed.php?url=https%3A%2F%2Fnews.google.co.in%2Fnews%3Fpz%max
=10&links=preserve&exc=&submit=Create+Feed was not found on this server.
How to write app.yaml for all php files which comes under various sub-folders??
Do i have to write handlers: for all individual php files??
I am stuck here for whole day.
I am new to this topic. So if you find this as stupid question please forgive me.
Here is my app.yaml
application: xxxx-xxxx-90212
version: alpha-001
runtime: php
api_version: 1
handlers:
- url: /
script: index.php
- url: /config
script: config.php
- url: /makefulltextfeed
script: makefulltextfeed.php
- url: /css
static_dir: css
- url: /js
static_dir: css
- url: /images
static_dir: images
I have php files in subfolder. How to write app.yaml for that.
As described here you can use this notation to match all root path, that ends with .php, to a php script
# Serve php scripts.
- url: /(.+\.php)$
script: \1
This config assume that each your URL ends with .php, you can modify url regex to catch all urls (I test only the regex but I think it's works :) )
# Serve ALL php scripts.
- url: /((.+\/).*)$
script: \1.php
Or you can simulate httpd mod_rewrite as described here.
Related
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
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.
I have been trying to deploy my project on Google Cloud SDK since yesterday and have been getting the same error over and over.
My app.yaml file looks like:
runtime: python27
api_version: 1
threadsafe: yes
- url: /
static_files: bin/index.html
upload: bin/index.html
- url: /assets
static_dir: bin/assets
- url: /src
static_dir: bin/src
- url: /vendor
static_dir: bin/vendor
- url: /templates-app.js
static_files: static/templates-app.js
upload: static/templates-app.js
- url: /templates-common.js
static_files: static/templates-common.js
upload: static/templates-common.js
- url: .*
script: main.app
I use this command to deploy:
gcloud preview app deploy app.yaml --version 1 --promote --force
And I get this error:
Beginning deployment...
Copying files to Google Cloud Storage...
Synchronizing files to [gs://staging.myapp.appspot.com/].
Updating module [default]...failed.
ERROR: (gcloud.preview.app.deploy) Error Response: [13] An internal error occurred.
I got the same error today Error Response: [13] An internal error occurred.
In my case, the issue was because I have a folder that has over 1000 files. Once I moved some of these files elsewhere, the internal error message disappeared!
I tried 1000 files in one folder, and it worked, then, I added one file (1001 files total) in the same folder, and the same internal error came back. It seems that it is kind of a limit that google app engine has 1000 files per folder.
I notice you don't have your app name in the app.yaml file and you also don't specify it in the upload cmd. I'd suggest making a habit in providing as much as the info as possible in the app.yaml to minimize the chances of human error. You can also specify the version in the app.yaml as well. This habit will help when you'll get to multi-modules apps, where such info is mandatory. See examples in the modules config doc.
From a different prospective, I saw several reports in which gcloud preview app deploy tripped, you can always try alternate approaches to rule out such cases, see my answer to this Q&A: Google App Engine deploy with Django module after gcloud update?
It ended up being the reportlab python library in the lib folder.
I found inserting it as a zip file rather than a normal folder worked.
import sys
sys.path.insert(0, 'reportlab.zip')
import reportlab
...
I have no idea why it wouldn't work. But I remember seeing something about a file limit when uploading projects with app-engine. Deploying 1 zip file is better than 181 files that make up reportlab.
I’m new to google app engine and I’m trying to configure my app.yaml file for a web application which utilizes php and ajax. I’ve got the application running in the PHP SDK using the following yaml file:
application: foobar
version: 1
runtime: php
api_version: 1
handlers:
- url: /stylesheets
static_dir: stylesheets
- url: /
script: index.php
- url: /ajax.php
script: ajax.php
- url: /index.*
script: index.php
- url: /about.*
script: about.php
- url: /terms.*
script: terms.php
- url: /contact.*
script: contact.php
- url: /update.*
script: update.php
login: required
secure: always
- url: /login.*
script: login.php
login: required
secure: always
- url: /.*
script: index.php
Although this is fundamentally working I’ve got a feeling I’m doing something wrong because I don’t really want to provide access to ajax.php since it is purely for ajax processing. When I type ‘ajax.php’ into the browser in IE9 I’m prompted to open or save ‘ajax.js’, which contains processing code from the ajax file. In other browsers the same code is dumped directly onto the webpage.
How can I allow ‘ajax.php’ file to be accessed by ‘index.php’ but avoid this issue?
I'm practically new to Google App Engine, but i have a homework to create some app with it.
I'm trying to debugging my app offline using google interactive shell. http://localhost:8080 looks fine, but when i tried to open http://localhost:8080/shell for debugging, it gave me broken URL. I have my directories checked, and they are fine for me.
I think my problem is in app.yaml file. Well, I know nothing about .yaml file, could anyone please tell me where I put something wrong in it?
Here's my app.yaml (I put all interactive shell properties in folder named 'shell')
application: myapp
version: 1
runtime: python
api_version: 1
handlers:
- url: /static
static_dir: shell/static
expiration: 1d
- url: /remote_api
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
- url: /shell.*
script: shell/shell.py
- url: /
script: myapp.py
Should the shell.* be shell in yaml rule if you want to find it in http://localhost:8080/shell
- url: /shell
script: shell/shell.py
I have a project directory and a sub directory set up as such:
/proj_dir
/proj_dir/audio
app.yaml:
handlers:
- url: /.*
script: main.py
- url: /audio
static_dir: audio
main.py is a simple Python program that, on a GET request, outputs the "index.html" file also in the proj_dir directory. The index.html file contains some javascript code that plays the audio file.
The problem is that index.html plays the audio file without issue when run locally. Once deployed, however, I get a 404 when trying to retrieve the audio:
INFO 2010-11-13 20:43:10,046 dev_appserver.py:3283] "GET /audio/bangagong.mp3 HTTP/1.1" 404 -
Any help appreciated. Thanks.
You need to change the order of your url handlers. The * handler captures everything. Try this instead:
handlers:
- url: /audio
static_dir: audio
- url: /.*
script: main.py