我正在尝试在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);
}
}
答案 0 :(得分:0)
我最近在CentOS 6.5上遇到了这个问题。关闭selinux解决了这个问题。
要测试你可以尝试:
# setenforce 0
显然,关闭selinux会产生安全隐患,所以一旦你确认它有效,你可能想看看创建一个selinux策略,允许apache访问openfisma目录中的文件。
答案 1 :(得分:0)
我遇到了同样的问题,但发现解决方案似乎也能正常工作,允许继续将selinux设置为强制执行。我运行了以下两个命令,我能够获得一个登录屏幕。
# semanage fcontext -a -t httpd_sys_rw_content_t "/usr/share/openfisma(/.*?)"
# restorecon -R -v /usr/share/openfisma/
从我目前对SELinux的了解,我在/ usr / share / openfisma目录的内容及其下面的任何内容上设置了一个httpd读写上下文。 restorecon将递归地重置该目录中所有文件的上下文。
编辑:我还发现需要以下命令
# /usr/sbin/setsebool -P httpd_can_network_connect on