Google App Engine PHP在部署的网站上包含错误

时间:2014-01-13 15:11:16

标签: php google-app-engine

我一直在本地使用Google App Engine PHP SDK开发一个PHP网站,一切都在我的机器上运行正常。然后,我部署了该网站,并表示它已成功上传,但是,当我查看托管网站时,该页面为空白。当我在App Dashboard中检查日志时,我收到了许多警告和错误:

PHP Warning:  include(): apc failed to locate includes/functions.php - bailing in /base/data/home/apps/s~raven3mil/1.373024475561310665/login.php on line 2

PHP Warning:  include(includes/functions.php): failed to open stream: No such file or directory in /base/data/home/apps/s~raven3mil/1.373024475561310665/login.php on line 2

PHP Warning:  include(): Failed opening 'includes/functions.php' for inclusion (include_path='.;/base/data/home/apps/s~raven3mil/1.373024475561310665/;/base/data/home/runtimes/php/sdk') in /base/data/home/apps/s~raven3mil/1.373024475561310665/login.php on line 2

PHP Warning:  require_once(includes/session.php): failed to open stream: No such file or directory in /base/data/home/apps/s~raven3mil/1.373024475561310665/login.php on line 3

PHP Fatal error:  require_once(): Failed opening required 'includes/session.php' (include_path='.;/base/data/home/apps/s~raven3mil/1.373024475561310665/;/base/data/home/runtimes/php/sdk') in /base/data/home/apps/s~raven3mil/1.373024475561310665/login.php on line 3

This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.

有没有人对此事有任何见解?我不知道从哪里开始......谢谢!

更新:

的app.yaml

application: raven3mil
version: 1
runtime: php
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: /includes
  static_dir: includes

- url: /fullcalendar-1.6.2/fullcalendar
  static_dir: fullcalendar-1.6.2/fullcalendar

- url: /ckeditor
  static_dir: ckeditor

  # Serve php scripts.
- url: /(.+\.php)
  script: \1

- url: /.*
  script: login.php

error_handlers:
- file: errors/404.php

应用程序名称匹配,一切都在本地运行良好。

2 个答案:

答案 0 :(得分:8)

默认情况下,除非您在app.yaml中将application_readable标志指定为处理程序的一部分,否则应用程序无法读取静态文件处理程序中的文件,因此您应该更改

- url: /includes
  static_dir: includes

- url: /includes
  static_dir: includes
  application_readable: true

当然,如果你在这个文件夹中只有php脚本,你实际上并不希望从你的应用程序提供,而只是想在运行时部署和访问,那么你应该一起删除这个处理程序。您不需要在app.yaml文件中输入要与您的应用程序一起上传的文件的条目,只有当您希望在响应传入请求时提供服务。

答案 1 :(得分:2)

错误也可能是由于某些操作系统(例如MAMP堆栈)不区分大小写,但Jetty(构建GAE)。因此,如果您正在开发Apache堆栈并迁移到GAE,则需要检查所有包含路径是否区分大小写。