App引擎PHP模块无法正常工作

时间:2016-08-02 09:11:33

标签: php python google-app-engine

我阅读了有关GAE模块的文档。此sample application显示了如何在GAE应用中使用模块。我已经对代码进行了一些修改,以便同时使用php and python languages

以下是相应代码所在的Github link

当我尝试在本地计算机上运行此应用程序时,通过运行此命令

dev_appserver.py dispatch.yaml app.yaml php.yaml static_backend.yaml --php_executable_path /usr/bin/php

除了用php编写的代码外,一切正常。当我尝试通过触发此localhost:8080/mobile/来访问该特定部分时,我会得到一个空页而不是Hello World

1 个答案:

答案 0 :(得分:1)

我已经运行了你的代码而没有任何问题。

php module python module

dev_appserver.py dispatch.yaml app.yaml php.yaml static_backend.yaml 
INFO     2016-08-03 04:19:01,413 devappserver2.py:769] Skipping SDK update check.
INFO     2016-08-03 04:19:01,517 api_server.py:205] Starting API server at: http://localhost:52017
INFO     2016-08-03 04:19:01,520 dispatcher.py:185] Starting dispatcher running at: http://localhost:8080
INFO     2016-08-03 04:19:01,526 dispatcher.py:197] Starting module "default" running at: http://localhost:8081
INFO     2016-08-03 04:19:01,718 dispatcher.py:197] Starting module "php-module" running at: http://localhost:8082
INFO     2016-08-03 04:19:01,734 dispatcher.py:197] Starting module "static-backend" running at: http://localhost:8083
INFO     2016-08-03 04:19:01,744 admin_server.py:116] Starting admin server at: http://localhost:8000
INFO     2016-08-03 04:19:02,209 module.py:1730] New instance for module "php-module" serving on:
http://localhost:8082

INFO     2016-08-03 04:19:02,759 module.py:1730] New instance for module "static-backend" serving on:
http://localhost:8083

INFO     2016-08-03 04:19:03,283 module.py:788] php-module: "GET /_ah/start HTTP/1.1" 200 24
INFO     2016-08-03 04:19:03,470 module.py:788] static-backend: "GET /_ah/start HTTP/1.1" 200 3108
INFO     2016-08-03 04:19:15,683 module.py:788] static-backend: "GET /mobile/ HTTP/1.1" 200 3752
INFO     2016-08-03 04:19:16,407 module.py:788] static-backend: "GET /favicon.ico HTTP/1.1" 200 3626
INFO     2016-08-03 04:19:18,914 module.py:788] static-backend: "GET /mobile HTTP/1.1" 200 3710
INFO     2016-08-03 04:19:19,345 module.py:788] static-backend: "GET /favicon.ico HTTP/1.1" 200 3650
INFO     2016-08-03 04:19:21,096 module.py:788] static-backend: "GET / HTTP/1.1" 200 3648

尝试以下方法:

  • 使用gcloud components install app-engine-php
  • 安装所有必要的PHP扩展程序
  • 省略--php-executable-flag
  • 使用终端上的which php命令确保其正确无误,并将--php-executable-flag指向您的php-cgi