0

我是 PHP 新手,我正在尝试移植一个已经在 Google App Engine 上运行的 webapp。我阅读了有关我需要编写的配置文件的 GAE 文档(app.yaml)

现在我到达了启动器为应用程序提供服务的地步,但是“PHP 流程”到达了一个完全空白的页面,而不是一个包含一些数据和我期望的表单的窗口。

我可以通过哪种方式调试 PHP 流程,看看出现了什么问题?

详细来说,这些是错误运行的文件:

根目录中的 index.php:

<?php
    include_once('tao/install/init.php');
    if(!tao_install_utils_System::isTAOInstalled()){
    header("location:tao/install");
}
else{
    header("location:tao/Main/entry");
}
?>

因此 tao/install 中的文件 init.php 将被称为应用程序的第一次运行

<?php 
// -- Install bootstrap
$rootDir = dir(dirname(__FILE__).'/../../');
$root = realpath($rootDir->path) . DIRECTORY_SEPARATOR ;
define('TAO_INSTALL_PATH', $root);
define('GENERIS_PATH', $root.'generis/');
set_include_path(get_include_path() . PATH_SEPARATOR . $root. PATH_SEPARATOR . GENERIS_PATH);


function install_loader($class_name){
    foreach (array(TAO_INSTALL_PATH, GENERIS_PATH) as $dir) {
        $path = str_replace('_', '/', $class_name);
        $file =  'class.' . basename($path). '.php';
        $filePath = $dir . dirname($path) . '/' . $file;
        if (file_exists($filePath)){
            require_once  $filePath;
            break;
        }
        else{
            $file = 'interface.' . basename($path). '.php';
            $filePath = $dir . dirname($path) . '/' . $file;
            if (file_exists($filePath)){
                require_once $filePath;
                break;
            }
        }
    }
}

spl_autoload_register('install_loader');

common_log_Dispatcher::singleton()->init(array(
    array(
        'class'         => 'SingleFileAppender',
        'threshold'     => common_Logger::TRACE_LEVEL,
        'file'          => TAO_INSTALL_PATH.'tao/install/log/install.log',
)));
require_once (GENERIS_PATH.'vendor/autoload.php');
require_once ('tao/helpers/class.Display.php');
require_once ('tao/helpers/class.Uri.php');

?>

这是我的临时 app.yaml

application: myapp
version: alpha-001
runtime: php
api_version: 1

handlers:
- url: /
  script: index.php

- url: /tao/install
  script: /tao/install/init.php

#- url: /stylesheets
#  static_dir: stylesheets

- url: /(.*\.(gif|png|jpg))$
  static_files: static/\1
  upload: static/.*\.(gif|png|jpg)$

编辑

我想我需要编辑 app.yaml :

require_once (GENERIS_PATH.'vendor/autoload.php');
require_once ('tao/helpers/class.Display.php');
require_once ('tao/helpers/class.Uri.php');

但我不明白如何

第二次编辑

这是GAE启动器的日志

2015-03-31 15:59:05 Running command: "['G:\\Python27\\python.exe', 'H:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=15080', '--admin_port=8007', u'F:\\davide\\tesi\\taov1']"
INFO     2015-03-31 15:59:07,522 devappserver2.py:726] Skipping SDK update check.
INFO     2015-03-31 15:59:07,611 api_server.py:172] Starting API server at: http://localhost:63287
INFO     2015-03-31 15:59:07,617 dispatcher.py:186] Starting module "default" running at: http://localhost:15080
INFO     2015-03-31 15:59:07,618 admin_server.py:118] Starting admin server at: http://localhost:8007
INFO     2015-03-31 16:09:54,970 module.py:737] default: "GET / HTTP/1.1" 302 -
INFO     2015-03-31 16:09:55,045 module.py:737] default: "GET /tao/install HTTP/1.1" 200 -
INFO     2015-03-31 16:09:55,207 module.py:737] default: "GET /favicon.ico HTTP/1.1" 404 -
4

1 回答 1

1

我终于找到了答案。正如@Mars 所说,问题出在 app.yaml 上。这是正确的形式:

application: mytaov1
version: alpha-test
runtime: php
api_version: 1

handlers:
- url: /
script: index.php
- url: /tao/install
script: /tao/install/index.html

app.yaml 中不需要 include() 路径,就像 required() 路径一样。他们被调用和处理没有问题。

于 2015-05-05T18:51:45.450 回答