【发布时间】:2015-05-30 09:57:57
【问题描述】:
我是 PHP 新手,我正在尝试移植一个已经在 Google App Engine 上运行的 web 应用程序。 我阅读了有关我需要编写的配置文件的 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 -
【问题讨论】:
-
如果
include_once('tao/install/init.php');是正确的位置,那么您必须像这样更改您的yaml 文件- url: /tao/install script: tao/install/init.php我相信toa目录在根目录内 -
感谢您的关注。是的,tao 是根目录中的一个目录,但如果我使用: - url: /tao/install script: tao/install/init.php 而不是 - url: /tao/install script: /tao/install/init.php 我遇到同样的情况
-
你能把它部署到非默认版本并检查那里的日志吗?
-
我什至不知道什么是非默认版本,我在哪里可以阅读它?我在 google docs 上找到了一些关于 gae 的内容,但在 PHP 部分没有找到
-
您可以查看this!您可以在 app.yaml 文件中将
version: alpha-001更改为version: alpha-test并进行部署。然后转到您的应用引擎应用程序-版本并单击alpha-test超链接,然后返回日志选择alpha-test并查看发生了什么
标签: php google-app-engine debugging porting app.yaml