I'm using PHP55 to run a web-page on standard environment through Google App Engine. When I click the submit button on a form, it downloads the respective PHP code that should instead be executing. Here's my app.yaml:
runtime: php55
api_version: 1
threadsafe: true
handlers:
- url: /
static_files: www/index.html
upload: www/index.html
- url: /signUp.html
static_files: www/signUp.html
upload: www/signUp.html
- url: /submitEmail.php
static_files: www/submitEmail.php
upload: www/submitEmail.php
- url: /(.*)
static_files: www/\1
upload: www/(.*)
EDIT 1
So I initially tried the following for the handlers:
handlers:
-url: /(.+\.php)$
script: www/\1
-url: /
script: www/index.html
-url: /(.*)
script: www/\1
However this was in short - a disaster. Images and CSS didn't load after refreshing. All I want is for submitEmail.php to execute when the user clicks submit on the form in index.html.
To clarify this is my high-level structure:
www/
-index.html
-submitEmail.php
app.yaml
EDIT 2
Present state of app.yaml but when I submit the form I receive a 404 error.
handlers:
-url: /(.+\.php)$
script: www/\1
-url: /submitEmail.php
script: www/submitEmail.php
-url: /
script: www/index.html
-url: /(.*)
script: www/\1
Well the PHP code is delivered because you declared it as static_files. Static files are delivered as-is to the client when requested.
Change your handler like this:
- url: /submitEmail.php
script: www/submitEmail.php
upload: www/submitEmail.php
See also app.yaml reference.
Related
I have the following directory structure:
/www
- index.html
- signUp.html
- submitEmail.php
And then above this:
/www
app.yaml
Here's my app.yaml file:
runtime: php55
api_version: 1
threadsafe: true
handlers:
- url: /(.+\.php)$
script: www/\1
- url: /
static_files: www/index.html
upload: www/index.html
- url: /(.*)
static_files: www/\1
upload: www/(.*)
When I click my submit form button I receive the following error:
No web page was found for the web address: https://<url>/submitEmail.php HTTP ERROR 404
Here's the form file:
<form class='email_form' action="/www/submitEmail.php" method="post">
<input class='input_email' id='limitedInput' type="text" name="email" placeholder="Email" autofocus>
<br>
<input type='text'>
</form>
I've been trying for hours to get this going but for some reason don't seem to be. Any help would be great thanks :)
The culprit was incorrect handlers in app.yaml. This works:
handlers:
- url: /(.+\.php)$
script: www/\1
- url: /
script: www/index.html
- url: /(.*)
script: www/\1
I think the static_file declaration screwed up the web-server. Unfortunately not versed enough to explain exactly why but hopefully this leads people in the right direction.
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/(.*)
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 :)'
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
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!
My image file is not found on the server. I declared it as static on my app.yaml:
- url: /sampleimage\.jpg
static_files: sampleimage.jpg
upload: sampleimage\.jpg
As you can see it's on the root directory, I tested it first on localhost and it is found:
localhost:8080/sampleimage.jpg
However when deployed on the web it's not there:
http://samplesite.appspot.com/sampleimage.jpg
I don't know what I'm doing wrong here because my favicon.ico which is also static file is working fine http://samplesite.appspot.com/favicon.ico.
complete app.yaml:
application: samplesite
version: 1
runtime: php
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /
script: index.html
- url: /sampleimage\.jpg
static_files: sampleimage.jpg
upload: sampleimage\.jpg
I recently add wordpress to Google App Engine
Everything is working fine in the local PHP SDK
I used git it deploy the site to GAE, problem is in the live site admin area (wp-admin) one css and one js is not loading so I'm getting a display like this
I checked the missing resource they are
myappid.appspot../wp-admin/load-styles.php?c=0&dir=ltr&load=admin-bar,wp-admin,buttons,wp-auth-check&ver=3.6.1
and
myappid.appspot.../wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils,json2&ver=3.6.1
These resources are loading fine in the local GAE PHP SDK. I'm using the same app.yaml that given in the google wordpress tutorial
I spend 2 days finding a solution for this Please help me out :)
This is my app.yaml file
application: entersys-wordpress
version: wp
runtime: php
api_version: 1
threadsafe: no
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /(.*\.(htm$|html$|css$|js$))
static_files: wordpress/\1
upload: wordpress/(.*\.(htm$|html$|css$|js$))
application_readable: true
- url: /wp-content/(.*\.(ico$|jpg$|png$|gif$))
static_files: wordpress/wp-content/\1
upload: wordpress/wp-content/(.*\.(ico$|jpg$|png$|gif$))
application_readable: true
- url: /(.*\.(ico$|jpg$|png$|gif$))
static_files: wordpress/\1
upload: wordpress/(.*\.(ico$|jpg$|png$|gif$))
- url: /wp-admin/(.+)
script: wordpress/wp-admin/\1
secure: always
- url: /wp-admin/
script: wordpress/wp-admin/index.php
secure: always
- url: /wp-login.php
script: wordpress/wp-login.php
secure: always
- url: /wp-cron.php
script: wordpress/wp-cron.php
login: admin
- url: /xmlrpc.php
script: wordpress/xmlrpc.php
- url: /(.+)?/?
script: wordpress/index.php
I think there is a bug if you use git to deploy not correctly pushing the static content.
I would try using the appcfg.py method to push your app to check (Follow Step 8 here).
Problem when uploading php application which uses Wordpress
* version - 1.8.0
* language - php
* operating system - Windows 7
Update to the GAE shows the below error for many files. Tried renaming few files but the error pops for another file and so on. These are wordpress 3.5.1 files.
Error 400: --- begin server output ---
Invalid character in filename: __static__\wordpress/wp-includes/css/admin-bar.css
--- end server output ---
The app.yaml content:
-------------------------------------------
application: fargocricketclub
version: 1
runtime: php
api_version: 1
threadsafe: yes
handlers:
- url: /(.*\.(htm$|html$|css$|js$))
static_files: wordpress/\1
upload: wordpress/(.*\.(htm$|html$|css$|js$))
application_readable: true
- url: /wp-content/(.*\.(ico$|jpg$|png$|gif$))
static_files: wordpress/wp-content/\1
upload: wordpress/wp-content/(.*\.(ico$|jpg$|png$|gif$))
application_readable: true
- url: /(.*\.(ico$|jpg$|png$|gif$))
static_files: wordpress/\1
upload: wordpress/(.*\.(ico$|jpg$|png$|gif$))
- url: /wp-admin/(.+)
script: wordpress/wp-admin/\1
secure: always
- url: /wp-admin/
script: wordpress/wp-admin/index.php
secure: always
- url: /wp-login.php
script: wordpress/wp-login.php
secure: always
- url: /wp-cron.php
script: wordpress/wp-cron.php
login: admin
- url: /xmlrpc.php
script: wordpress/xmlrpc.php
- url: /(.+)?/?
script: wordpress/index.php
I believe that this is fixed in the 1.8.1 release of App Engine, using the solution proposed above to join the path using the OS specific path separator.
Issue seen in PHP & Python 1.8.1 deployments on Windows when using application_readable. Issue flagged: https://code.google.com/p/googleappengine/issues/detail?id=9558
Work around:
replaced os.path.join with posixpath.join in google\appengine\tools\appcfg.py