3

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

Chris Armitage
  • 357
  • 5
  • 11
  • To cover the bases, post the full console output, post your app.yaml, and post your script handler file contents. Also, verify which version of both PHP and Python you have installed. – BrettJ Oct 13 '16 at 04:53
  • Seems really unlikely, but if you omit the --host parameter and let that default to localhost, do you still have the same outcome? – BrettJ Oct 13 '16 at 16:58
  • Hi Chris! Do you get sensible output from port 8000? It's the local dev admin pages. – Tom Oct 13 '16 at 18:15
  • @BrettJ Tried accessing it locally via curl, but still got a blank response and a hit in the access logs. Hi @Tom! Using `--admin_host=0.0.0.0` I can see int instances page. Starts with one entry. After the first request, shows 2 requests for the original instance (/ and favicon.ico) with another instance listed. Original instance goes up by 2 for every request, matching the access log activity – Chris Armitage Oct 14 '16 at 08:52
  • Try omitting the --php_executable_path=/usr/bin/php flag. It isn't always required. I'm starting to think its something specific about Centos or Vagrant with Vagrant seeming more likely. – BrettJ Oct 14 '16 at 14:42
  • Running without the php_executable_flag fails to start. I'm gonna try it on a different OS, see if I have any luck. – Chris Armitage Oct 14 '16 at 14:56
  • I am replicating your problem on a Centos 7 virtual machine instance running on Compute Engine. Thanks for putting up with the questions. I am going to report this as a bug internally here at Google. – BrettJ Oct 14 '16 at 16:59

1 Answers1

6

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

Chris Armitage
  • 357
  • 5
  • 11
  • thanks! that's a hard one and this seems the only answer I've found online. Google's documentation are quite poor, following their tutorial almost certain to end up in peril. – user7180 Aug 20 '17 at 14:30