首页 > 解决方案 > 如何确定 Yii 应用程序执行的结束位置?

问题描述

先决条件:在 Ubuntu 上运行。使用阿帕奇。Yii 版本正在打印 1.1.2。

我的问题:

我正在帮助一位朋友开发一个 Web 应用程序,但他的应用程序开发人员突然退出。问题是,我对 PHP 有点陌生,对 Yii 完全是绿色。我很难使用现有代码设置测试服务器。发生的事情是 index.php 代码调用了一个 CWebApplication 派生类,但 run() 方法永远不会返回,我得到的只是一个空白页面(这显然不会在生产中发生)。我试图了解如何确定正在发生的事情,以及执行正在死亡的地方。

首先,让我说我运行了 http:///yii/requirements/index.php,需求检查器声称我有运行的最低要求。

其次,我的 index.php 看起来像这样:

ini_set('display_errors',1);

// change the following paths if necessary
$yii=dirname(__FILE__).'/yii/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';
$gapi = dirname(__FILE__) . '/protected/vendors/Google/autoload.php';

// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

require_once($gapi);
require_once($yii);
/*
 * Manage URL Uppercase or lowercase
 */

$manage_url_path = dirname(__FILE__) . '/protected/components/ManageUrl.php';
require_once( $manage_url_path );
$create_web_application = new ManageUrl($config);
$create_web_application->run();

当 $create_web_application->run() 执行时,它永远不会返回(在它什么都不打印后打印),我只得到一个空白页。

这个类(ManageUrl)覆盖了createController,但到目前为止感觉好像执行从未到达这个函数。将任何 print() 语句放在那里什么都没有显示。$Yii::log() 也没有显示任何内容。/runtime 下的 application.log 中没有任何内容。Apache 的错误日志也没有显示任何内容。就好像代码执行只是进入了一个黑洞。

最后要注意的一件事:我在服务器上启用了 mod_rewrite。我在 DigitalOcean 上按照这个过时的方法来开始工作(https://www.digitalocean.com/community/tutorials/how-to-install-and-setup-yii-php-framework-on-ubuntu-12-04) .

你能告诉我如何弄清楚这个应用程序发生了什么以及为什么我只是得到一个空白页吗?我需要弄清楚代码执行的去向以及随后的死亡。

标签: yiiyii1.x

解决方案


推荐阅读