Some fonts dont work Google App Engine (wordpress) - php

I have installed wordpress in GAE. My wordpress installation has the popular Woocommerce plugin activated. The problem with this setup is that some of my fonts are not working. This is what I see :
The boxes should actually be stars. I am not sure, but I think this is happening because the mime type cant be guessed by GAE. In my browser console, I get the following messages
Resource interpreted as Image but transferred with MIME type
application/x-javascript:
this is my app.yaml:
application: XXXXXXX
version: 101
runtime: php
api_version: 1
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: /wp-(.+).php
script: wordpress/wp-\1.php
- url: /(.+)?/?
script: wordpress/index.php
- url: /(.*\.woff)
static_files: wordpress/\1
upload: wordpress/(.*\.woff)
mime_type: application/font-woff
- url: /(.*\.svg)
static_files: wordpress/\1
upload: wordpress/(.*\.svg)
mime_type: image/svg+xml
- url: /(.*\.eot)
static_files: wordpress/\1
upload: wordpress/(.*\.eot)
mime_type: application/vnd.ms-fontobject
- url: /(.*\.ttf)
static_files: wordpress/\1
upload: wordpress/(.*\.ttf)
mime_type: application/x-font-ttf
- url: /(.*\.otf)
static_files: wordpress/\1
upload: wordpress/(.*\.otf)
mime_type: application/x-font-otf

My limited (and possibly stale) experience with pagespeed suggests that you might consider disabling it until you have everything else working.
The only thing that jumps out is that the first two - url: stanzas in your app.yaml should be exchanged. These stanzas are consulted in order. /wp-content/foo.js will be matched by the more general first stanza, which looks like it isn't what you want. I doubt that's what's causing the mime type confusion, but turning off pagespeed should give you better info for further debugging.

Related

App engine downloading PHP code instead of displaying

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.

Google App Engine, PHP: reads javascript, images and css as Text files

I deployed a PHP application on Google App Engine, I tried different configurations of the app.yaml file and still can't get static files to be recognized.
Here is my code:
application: double-goal-88313
version: 1
runtime: php
api_version: 1
handlers:
- url: /Maps/stylesheet
static_dir: Maps/stylesheet
mime_type: 'text/css'
- url: /logodoc.png
static_dir: Maps/images/logodoc.png
application_readable: true
- url: /Maps/js
static_dir: Maps/js
mime_type: 'application/javascript'
- url: /findDoctor/.*
script: Maps/index.php
Thank you!
Looking at your comments in the above post you probably need something like
handlers:
- url: /Maps/stylesheet
static_dir: Maps/stylesheet
- url: /logodoc.png
static_files: Maps/images/logodoc.png
upload: Maps/images/logodoc.png
application_readable: true
- url: /Maps/js/(.*)
script: Maps/js/\1
- url: /findDoctor/(.*\.(htm|html|css|js))$
static_files: Maps/\1
upload: Maps/.*\.(htm|html|css|js)$
- url: /findDoctor/.*
script: Maps/index.php
First you can have a look at configuring app.yaml
then try
handlers:
- url: /Maps/stylesheet
static_dir: Maps/stylesheet
- url: /logodoc.png
static_files: Maps/images/logodoc.png
upload: Maps/images/logodoc.png
application_readable: true
- url: /Maps/js/(.*)
script: Maps/js/\1
- url: /findDoctor/.*
script: Maps/index.php
Now you can access
your-app-version.appspot.com/logodoc.png and your-app-version.appspot.com/Maps/js/file.js file.js should be inside js/file.js

Google App Engine app.yaml file for PHP app (Magenta App)

I am working on this app.yaml file to put Magento app on GAE. I have read most replies related to app.yaml files. Here is one for wordpress app. However, I feel very confused with so many different versions.
https://github.com/eGlobeBizCom/appengine-php-wordpress-starter-project/blob/9130e8ca06fa52a84821b8faffa49b83792b8ebf/app.yaml
But, the Magento app and Drupal structures are different from Wordpress app. I have tried several versions of app.yaml, not working. I really wish to find out what are the exact rules for the correct code in the app.yaml file for PHP apps, thus newbies can test apps on GAE very quickly without this big huddle. Thank you !
It depends, the app.yaml must always be present and corresponds to your default module.
You can see your modules at the google developer console -> appengine -> versions (should be modules). Each module can have lots of versions.
E.g.: To serve your application files (php files only) and your static files (everything else) from different modules, have a look at the following app.yaml and xml.yaml files:
app.yaml:
application: viewneo-eu
version: pro # production
runtime: php
api_version: 1
threadsafe: true
instance_class: F4
automatic_scaling:
min_idle_instances: 1 # one instance idleing forever
max_idle_instances: 4 # 4 x 50 = 200 max requests
min_pending_latency: 10ms # wait at least, before launching a new instance
max_pending_latency: automatic # after this time, create a new instance
max_concurrent_requests: 50
default_expiration: "0m"
handlers:
- url: /(.+)?/?
secure: always
script: build/mod_rewrite.php
- url: /.*
secure: always
script: build/mod_rewrite.php
xml.yaml:
application: viewneo-eu
module: xml
version: pro
runtime: php
api_version: 1
threadsafe: true
instance_class: F1
automatic_scaling:
min_idle_instances: 1 # one instance idleing forever
max_idle_instances: 4 # 4 x 50 = 200 max requests
min_pending_latency: 10ms # wait at least, before launching a new instance
max_pending_latency: automatic # after this time, create a new instance
max_concurrent_requests: 50
default_expiration: "0m"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
static_files: static/html/\1
upload: static/html/(.*\.(appcache|manifest))
expiration: "0m"
application_readable: true
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.atom)
mime_type: application/atom+xml
static_files: static/html/\1
upload: static/html/(.*\.atom)
expiration: "1h"
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.htc)
mime_type: text/x-component
static_files: static/html/\1
upload: static/html/(.*\.htc)
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.html)
mime_type: text/html
static_files: static/html/\1
upload: static/html/(.*\.html)
expiration: "7d"
application_readable: true
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.tpl)
mime_type: text/html
static_files: static/html/\1
upload: static/html/(.*\.tpl)
expiration: "7d"
application_readable: true
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.rss)
mime_type: application/rss+xml
static_files: static/html/\1
upload: static/html/(.*\.rss)
expiration: "1h"
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.txt)
mime_type: text/plain
static_files: static/html/\1
upload: static/html/(.*\.txt)
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.xml)
mime_type: application/xml
static_files: static/html/\1
upload: static/html/(.*\.xml)
expiration: "1h"
application_readable: true
http_headers:
Access-Control-Allow-Origin: "*"
I've split various content types to different modules, which requires dispatch.yaml:
dispatch.yaml:
application: viewneo-eu
dispatch:
- url: "fonts.viewneo-eu.appspot.com/*"
module: fonts
- url: "img.viewneo-eu.appspot.com/*"
module: img
- url: "css.viewneo-eu.appspot.com/*"
module: css
- url: "js.viewneo-eu.appspot.com/*"
module: js
- url: "html.viewneo-eu.appspot.com/*"
module: html
- url: "cdn.viewneo-eu.appspot.com/*"
module: cdn
- url: "video.viewneo-eu.appspot.com/*"
module: cdn
- url: "audio.viewneo-eu.appspot.com/*"
module: cdn
- url: "dev.viewneo-eu.appspot.com/*"
module: dev
- url: "beta.viewneo-eu.appspot.com/*"
module: beta
As we're using secure always in our app.yaml and ssl won't work for wildcard sub sub domains, you can always access these through
https://fonts-dot-viewneo-eu.appspot.com,
https://img-dot-viewneo-eu.appsport.com,
...
and so on.
Hope that helps.
Regards
Ron

wordpress in GAE wp-admin area css and js not loading

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).

php app update: Invalid character in filename

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

Categories