I'm following the GAE PHP tutorial but I can't get the local dev server to respond properly.
I run it with
dev_appserver.py --php_executable_path=/usr/bin/php --host=192.168.33.44 ./
and it starts up fine. When I view http://192.168.33.44:8080/ the logs show
INFO 2016-10-12 07:55:06,264 module.py:788] default: "GET / HTTP/1.1" 200 -
but I get a blank page. There's nothing in the tutorial explaining what to do if you have problems.
So far, I've:
Tried PHP 5.5 and 5.6 (remi): no difference
Put corrupt PHP in helloworld.php: no errors
Changed the handler to - url: /: blank page on /, 404 page for any other URL
Scoured Google Docs: no help
Scoured Google: no help
Asked the rubber duck: no help
I'm running Centos 7.2 via Vagrant and Google Cloud SDK 129.0.0.
Any and all help greatly appreciated.
[EDIT]
Additional data as requested
$ which php
/usr/bin/php
$ /usr/bin/php -v
PHP 5.5.38 (cli) (built: Sep 19 2016 13:45:10)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
$ which python
/usr/bin/python
$ /usr/bin/python -V
Python 2.7.5
$ cat app.yaml
runtime: php55
api_version: 1
handlers:
- url: /.*
script: helloworld.php
$ cat helloworld.php
<?php
echo 'Hello, World!';
$ dev_appserver.py --php_executable_path=/usr/bin/php --host=192.168.33.44 ./
Updates are available for some Cloud SDK components. To install them, please run:
$ gcloud components update
INFO 2016-10-13 08:21:22,699 devappserver2.py:769] Skipping SDK update check.
INFO 2016-10-13 08:21:22,730 api_server.py:205] Starting API server at: http://localhost:46453
INFO 2016-10-13 08:21:22,737 dispatcher.py:197] Starting module "default" running at: http://192.168.33.44:8080
INFO 2016-10-13 08:21:22,738 admin_server.py:116] Starting admin server at: http://localhost:8000
INFO 2016-10-13 08:21:34,142 module.py:788] default: "GET / HTTP/1.1" 200 -
Response Headers from Chrome when accessing http://192.168.33.44:8080/
Cache-Control: no-cache
Content-Length: 0
Content-Type: text/html
Date: Thu, 13 Oct 2016 08:21:34 GMT
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Server: Development/2.0
I updated from 129 to 130 but the same problem exists
Turns out the problem was a trivial oversight...
dev_appserver.py --php_executable_path=/usr/bin/php --host=192.168.33.44 ./
Should have been
dev_appserver.py --php_executable_path=/usr/bin/php-cgi --host=192.168.33.44 ./
The App Engine requires the php-cgi binary, not the cli one. Ended up stumbling over it in the docs a while ago, but forgot to come back here and post the answer
Related
EDIT: I have fixed the problem - see my answer below
I have an app (flyxc.app) that has been deployed for a few months without any issues.
I tried to deploy the app again yesterday and get errors:
Uncaught SyntaxError: Invalid or unexpected token from parsing my js.
This is because the JS looks like:
[q*u�Md�m��0�yw������N�綥4q
rG7��yt�i���#UU�1�.P�\���~�Z��n>N�H'Y0L�t�s������㞰*�
�T&�i��>�-o���T�1���'`�7uǀ�v��!/z}���aC����C�<���}����"� XԼ�g�ӳ�rl-ZU���-Z��*)rA�u�8v*�>l��>!���mHCu�6��Vt��8H� tH��?
jC_����W7_e��7'��z��8R��u�t~)����w\�ƭ�"*�}���ľ�O�b~U����f��+w8rS0$]f��U�˲�2To5.�Gb;�_����~m�z�f
...
By looking at the size of the JS, it seems that it is gzip encoded however the response headers do not contain the content-encoding header:
alt-svc: h3-27=":443"; ma=2592000,h3-25=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
cache-control: max-age=0
content-length: 72212
content-type: application/javascript; charset=utf-8
date: Sun, 31 May 2020 15:11:57 GMT
last-modified: Tue, 01 Jan 1980 00:00:01 GMT
server: Google Frontend
status: 200
vary: Accept-Encoding
x-cloud-trace-context: c0f4c28a3d84fdb29a8d7caf0d1bbf83;o=1
I did install the ModHeader chrome extension to remove the accept-encoding header from the request.
Removing the header force the server not zip the response and give the expected payload:
function e(e,t,i,o){var r,s=arguments.length,n=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(s<3?r(n):s>3?r(t,i,n):r(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n}function t(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}const i=new WeakMap,o=e=>(...t)=>{const o=e(...t);return i.set(o,!0),o},r=e=>"function"==typeof e&&i.has(e),s="undefined"!=typeof window&&null!=window.customElements&&void 0!==window...
The JS is served directly by the servers. Here is my app.yml:
runtime: nodejs12
instance_class: F1
automatic_scaling:
max_concurrent_requests: 80
target_cpu_utilization: 0.9
handlers:
- url: /.*
secure: always
redirect_http_response_code: 301
script: auto
Because there seems to be no way to control this header on the app engine side, I suspect a problem on the app engine side.
Could someone help ?
I have fixed the problem.
The JS was actually served by a Koa JS server.
The Koa server used to compress the JS.
In the end the JS was double gzipped.
I have removed the compression in the Koa server and now everything works fine.
Note: I still do not exactly understand why I worked for 6 months before starting to fail on May 31 - the compression is the Koa server has been here for the last 6 months.
Having installed Haskell Platform 2013.2.0.0, and using Win7 cmd:
When running the command "cabal update"
I got the following output:
Downloading the latest package list from hackage.haskell.org
cabal: Failed to download http://hackage.haskell.org/packages/archive/00-index.tar.gz
: ErrorMisc "Unsucessful HTTP code: 400"
To confirm that the link was working, I visited it on my web browser.
At this stage, I'm sorta stuck as to how to resolve the issue.
Also, I'm not sure whether this would help or not, but here's what I get when I run "cabal update -v3"
Downloading the latest package list from hackage.haskell.org
Sending:
GET /packages/archive/00-index.tar.gz HTTP/1.1
Host: hackage.haskell.org
User-Agent: cabal-install/1.16.0.2
Creating new connection to hackage.haskell.org
Received:
HTTP/1.1 400 Bad Request
Server: nginx/1.6.0
Date: Thu, 31 Jul 2014 16:24:24 GMT
Content-Type: text/html
Content-Length: 172
Connection: close
cabal: Failed to download
http://hackage.haskell.org/packages/archive/00-index.tar.gz : ErrorMisc
"Unsucessful HTTP code: 400"
I could solve this problem in my machine by disabling the antivirus and firewall, hope it will help.
Good morning, I am new to the Google Cloud Platform.
I am trying to follow the tutorial to deploy an Hadoop Cluster and I am experiencing some problems.
I have installed the Cloud SDK, created a new project from the web interface, created a new bucket, enabled billing, obtained the permission "Can edit" (default), generated the pair of ssh keys and put them in $HOME/.ssh/ and configured the bdutil_env.sh script to use my project and my bucket.
This is what happens when I execute some commands in the shell:
$ gcloud auth login
(I choose Allow in the web page opened ->You are now authenticated with the Google Cloud SDK!)
You are now logged in as myaddress#gmail.com.
Your current project is project-id.
My project-id is wordcountex.
Now every command that uses my project gets an error. For example:
$ gcutil getproject --project=project-id --cache_flag_values --dump_request_response
INFO: --request-start--
INFO: -headers-start-
INFO: accept-encoding: gzip, deflate
INFO: accept: application/json
INFO: user-agent: google-api-python-client/1.0
INFO: -headers-end-
INFO: -path-parameters-start-
INFO: project: wordcountex
INFO: -path-parameters-end-
INFO: body: None
INFO: query: ?alt=json
INFO: --request-end--
INFO: URL being requested: https://www.googleapis.com/compute/v1/projects/wordcountex?alt=json
Error: The resource 'projects/project-id' was not found
What should I do now?
I have tried to follow some other guides (this suggested to remove multiple gmail accounts: I did it; it says to visit the Google Compute Engine page once from the console: what does it mean?).
I am running on Ubuntu 14.04 LTS.
I solved my problem enabling the Compute Engine API: Console -> My Project -> APIs & Auth -> APIs.
I am trying to modify the Counter Mirror Example and get it running from my computer.
Instead of just incrementing by 1, I'd like to increment by 10 (trivial, yes but the goal is to get it running) so I changed the the necessary line in handler.py (in /notify) to:
'increment': lambda num: num + 10,
As for the basic glassware setting up:
In the API console I added the counteraugmented.appspot dot com/oauthcallback and localhost/oauthcallback (i cant post localhost or >2 links, sorry)
Glass API is turned on.
Updated client_secret.json with the id, secret and redirect uri's. Triple checked spelling and all instances included https, not http
Updated app.yaml with application name.
ran:
./appcfg --oauth2 update counteraugmented/
output:
08:43 PM Host: appengine.google.com
08:43 PM Application: counteraugmented; version: 1
08:43 PM
Starting update of app: counteraugmented, version: 1
08:43 PM Getting current resource limits.
08:43 PM Scanning files on local disk.
08:43 PM Cloning 13 static files.
08:43 PM Cloning 60 application files.
08:43 PM Compilation starting.
08:43 PM Compilation completed.
08:43 PM Starting deployment.
08:43 PM Checking if deployment succeeded.
08:43 PM Deployment successful.
08:43 PM Checking if updated app version is serving.
08:44 PM Completed update of app: counteraugmented, version: 1
Went to https://counteraugmented.appspot.com/oauth2callback and got a 404 error.
In the API console log:
2013-08-06 20:53:50.500 /oauth2callback 404 14ms 0kb Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36
70.166.86.68 - - [06/Aug/2013:20:53:50 -0700] "GET /oauth2callback HTTP/1.1" 404 188 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" "counteraugmented.appspot.com" ms=15 cpu_ms=0 cpm_usd=0.000021 app_engine_release=1.8.3 instance=00c61b117c0e4f53bedaf5e84288859a16dd0b9e
I successfully got the python quickstart example running, this is my next hurdle.
Any suggestions on how I can go about remedying this would be greatly appreciated. (Obviously new to oauth, stackoverflow and glassdev). Thanks!
I'm on Win 8 x64, Python 2.7
Steps I followed:
Downloaded, installed python.
Downloaded, installed Google App Engine Launcher.
Created new application with name helloworld-kg on the app engine site.
In Launcher, File > Create New Application > entered the name of app and browsed to the directory.
Hit Run, wait for light to turn green.
Click Browser. Get a blank page on localhost:8080
Here's the log from launcher:
2013-04-05 20:54:10 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000', u'C:\\Users\\Karan\\Desktop\\helloworld-kg\\helloworld-kg']"
INFO 2013-04-05 20:54:12,068 devappserver2.py:401] Skipping SDK update check.
WARNING 2013-04-05 20:54:12,078 api_server.py:328] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-04-05 20:54:12,088 api_server.py:152] Starting API server at: http://localhost:55309
INFO 2013-04-05 20:54:12,091 dispatcher.py:98] Starting server "default" running at: http://localhost:8080
INFO 2013-04-05 20:54:12,092 admin_server.py:117] Starting admin server at: http://localhost:8000
INFO 2013-04-05 20:54:58,167 api_server.py:517] Applying all pending transactions and saving the datastore
INFO 2013-04-05 20:54:58,167 api_server.py:520] Saving search indexes
2013-04-05 20:54:58 (Process exited with code 0)
2013-04-05 20:55:01 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000', u'C:\\Users\\Karan\\Desktop\\helloworld-kg\\helloworld-kg']"
INFO 2013-04-05 20:55:03,788 devappserver2.py:401] Skipping SDK update check.
WARNING 2013-04-05 20:55:03,799 api_server.py:328] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-04-05 20:55:03,809 api_server.py:152] Starting API server at: http://localhost:55354
INFO 2013-04-05 20:55:03,811 dispatcher.py:98] Starting server "default" running at: http://localhost:8080
INFO 2013-04-05 20:55:03,813 admin_server.py:117] Starting admin server at: http://localhost:8000
INFO 2013-04-05 20:56:02,868 api_server.py:517] Applying all pending transactions and saving the datastore
INFO 2013-04-05 20:56:02,869 api_server.py:520] Saving search indexes
2013-04-05 20:56:02 (Process exited with code 0)
2013-04-05 20:56:09 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000', u'C:\\Users\\Karan\\Desktop\\helloworld-kg\\helloworld-kg']"
INFO 2013-04-05 20:56:11,631 devappserver2.py:401] Skipping SDK update check.
WARNING 2013-04-05 20:56:11,644 api_server.py:328] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-04-05 20:56:11,653 api_server.py:152] Starting API server at: http://localhost:55397
INFO 2013-04-05 20:56:11,655 dispatcher.py:98] Starting server "default" running at: http://localhost:8080
INFO 2013-04-05 20:56:11,657 admin_server.py:117] Starting admin server at: http://localhost:8000
My app.yaml file contents:
application: helloworld-kg
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
script: helloworld-kg.app
And the helloworld-kg.py file contents:
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, webapp2 World!')
app = webapp2.WSGIApplication([('/', MainPage)],
debug=True)
I'm new with Python and GAE. This is for Udacity's CS 253 course.
Possible solutions?
Got it to work. Apparently, GAEL was creating a new app for me. A re-install solved the problem. App is working fine now!