我正在尝试在 AWS 的 Ubuntu AMI 上运行一个名为 OpenFISMA 的程序。该应用程序并没有真正在 Ubuntu 平台上编码,但我在我的舒适区,并尝试了 CentOS 和 OpenSUSE(两者都是应用程序的“原生”)让它以相同或更差的结果工作。那么,为什么不让它在 Ubuntu 上运行呢?无论如何,该应用程序可在此处找到:www.openfisma.org,安装指南可在此处找到:https ://openfisma.atlassian.net/wiki/display/030100/Installation+Guide安装指南有点糟糕。它没有以任何连贯的方式列出依赖关系,也没有提供任何细节(甚至在整个页面上都没有提到 Zend),所以我做了很多工作来预测我所拥有的信息。这个页面提供了一些依赖 inf(虽然 Zend 没有被提及一次):https://openfisma.atlassian.net/wiki/display/PUBLIC/RPM+Management#RPMManagement-BasicOverviewofRPMPackages
无论如何,我已经完成了安装(只要我能重建它)。我是第一次进入登录页面,当我加载页面时应该会发生某种引导。(我不是程序员,所以我不知道它在那里做什么。)无论如何,我在网页上收到一条消息,上面写着:“引导应用程序时发生异常。”
因此,然后我查看 /var/www/data/logs/php.log 并找到以下消息:
[22-Oct-2013 17:29:18 UTC] PHP Fatal error: Uncaught exception 'Zend_Exception' with message 'No entry is registered for key 'Zend_Log'' in /var/www/library/Zend/Registry.php:147
Stack trace:
#0 /var/www/public/index.php(188): Zend_Registry::get('Zend_Log')
#1 {main}
thrown in /var/www/library/Zend/Registry.php on line 147
每次我加载页面时都会发生这种情况。我收集到与在 Zend 注册表中注册 Zend_Log 变量有关的问题,但除此之外,我真的不知道该怎么做。我是否缺少它需要的包,或者这个应用程序没有编码以正确注册变量?我没有任何线索。任何帮助是极大的赞赏。日志消息 (index.php) 中引用的应用程序文件包含在下面。
<?php
/**
* Copyright (c) 2008 Endeavor Systems, Inc.
*
* This file is part of OpenFISMA.
*
* OpenFISMA is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenFISMA is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with OpenFISMA. If not, see
* {@link http://www.gnu.org/licenses/}.
*/
try {
defined('APPLICATION_PATH')
|| define(
'APPLICATION_PATH',
realpath(dirname(__FILE__) . '/../application')
);
// Define application environment
defined('APPLICATION_ENV')
|| define(
'APPLICATION_ENV',
(getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')
);
set_include_path(
APPLICATION_PATH . '/../library/Symfony/Components' . PATH_SEPARATOR .
APPLICATION_PATH . '/../library' . PATH_SEPARATOR .
get_include_path()
);
require_once 'Fisma.php';
require_once 'Zend/Application.php';
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/config/application.ini'
);
Fisma::setAppConfig($application->getOptions());
Fisma::initialize(Fisma::RUN_MODE_WEB_APP);
$application->bootstrap()->run();
} catch (Zend_Config_Exception $zce) {
// A zend config exception indicates that the application may not be installed properly
echo '<h1>The application is not installed correctly</h1>';
$zceMsg = $zce->getMessage();
if (stristr($zceMsg, 'parse_ini_file') !== false) {
if (stristr($zceMsg, 'application.ini') !== false) {
if (stristr($zceMsg, 'No such file or directory') !== false) {
echo 'The ' . APPLICATION_PATH . '/config/application.ini file is missing.';
} elseif (stristr($zceMsg, 'Permission denied') !== false) {
echo 'The ' . APPLICATION_PATH . '/config/application.ini file does not have the ' .
'appropriate permissions set for the application to read it.';
} else {
echo 'An ini-parsing error has occured in ' . APPLICATION_PATH . '/config/application.ini ' .
'<br/>Please check this file and make sure everything is setup correctly.';
}
} else if (stristr($zceMsg, 'database.ini') !== false) {
if (stristr($zceMsg, 'No such file or directory') !== false) {
echo 'The ' . APPLICATION_PATH . '/config/database.ini file is missing.<br/>';
echo 'If you find a database.ini.template file in the config directory, edit this file ' .
'appropriately and rename it to database.ini';
} elseif (stristr($zceMsg, 'Permission denied') !== false) {
echo 'The ' . APPLICATION_PATH . '/config/database.ini file does not have the appropriate ' .
'permissions set for the application to read it.';
} else {
echo 'An ini-parsing error has occured in ' . APPLICATION_PATH . '/config/database.ini ' .
'<br/>Please check this file and make sure everything is setup correctly.';
}
} else {
echo 'An ini-parsing error has occured. <br/>Please check all configuration files and make sure ' .
'everything is setup correctly';
}
} elseif (stristr($zceMsg, 'syntax error') !== false) {
if (stristr($zceMsg, 'application.ini') !== false) {
echo 'There is a syntax error in ' . APPLICATION_PATH . '/config/application.ini ' .
'<br/>Please check this file and make sure everything is setup correctly.';
} elseif (stristr($zceMsg, 'database.ini') !== false) {
echo 'There is a syntax error in ' . APPLICATION_PATH . '/config/database.ini ' .
'<br/>Please check this file and make sure everything is setup correctly.';
} else {
echo 'A syntax error has been reached. <br/>Please check all configuration files and make sure ' .
'everything is setup correctly.';
}
} else {
// Then the exception message says nothing about parse_ini_file nor 'syntax error'
echo 'Please check all configuration files, and ensure all settings are valid.';
}
echo '<br/>For more information and help on installing OpenFISMA, please refer to the ' .
'<a target="_blank" href="http://manual.openfisma.org/display/ADMIN/Installation">' .
'Installation Guide</a>';
} catch (Doctrine_Manager_Exception $dme) {
echo '<h1>An exception occurred while bootstrapping the application.</h1>';
// Does database.ini have valid settings? Or is it the same content as database.ini.template?
$databaseIniFail = false;
$iniData = file(APPLICATION_PATH . '/config/database.ini');
$iniData = str_replace(chr(10), '', $iniData);
if (in_array('db.adapter = ##DB_ADAPTER##', $iniData)) {
$databaseIniFail = true;
}
if (in_array('db.host = ##DB_HOST##', $iniData)) {
$databaseIniFail = true;
}
if (in_array('db.port = ##DB_PORT##', $iniData)) {
$databaseIniFail = true;
}
if (in_array('db.username = ##DB_USER##', $iniData)) {
$databaseIniFail = true;
}
if (in_array('db.password = ##DB_PASS##', $iniData)) {
$databaseIniFail = true;
}
if (in_array('db.schema = ##DB_NAME##', $iniData)) {
$databaseIniFail = true;
}
if ($databaseIniFail) {
echo 'You have not applied the settings in ' . APPLICATION_PATH . '/config/database.ini appropriately. ' .
'Please review the contents of this file and try again.';
} else {
if (Fisma::debug()) {
echo '<p>'
. get_class($dme)
. '</p><p>'
. $dme->getMessage()
. '</p><p>'
. "<p><pre>Stack Trace:\n"
. $dme->getTraceAsString()
. '</pre></p>';
} else {
$logString = get_class($dme)
. "\n"
. $dme->getMessage()
. "\nStack Trace:\n"
. $dme->getTraceAsString()
. "\n";
Zend_Registry::get('Zend_Log')->err($logString);
}
}
} catch (Exception $exception) {
// If a bootstrap exception occurs, that indicates a serious problem, such as a syntax error.
// We won't be able to do anything except display an error.
echo '<h1>An exception occurred while bootstrapping the application.</h1>';
if (Fisma::debug()) {
echo '<p>'
. get_class($exception)
. '</p><p>'
. $exception->getMessage()
. '</p><p>'
. "<p><pre>Stack Trace:\n"
. $exception->getTraceAsString()
. '</pre></p>';
} else {
$logString = get_class($exception)
. "\n"
. $exception->getMessage()
. "\nStack Trace:\n"
. $exception->getTraceAsString()
. "\n";
Zend_Registry::get('Zend_Log')->err($logString);
}
}