当我尝试运行Zend Framework创建的项目时,出现以下错误。它正在寻找Zend / Application.php,它可以在我的include_path目录中找到。我对该目录有读权限。
PHP致命错误:require_once()[function.require]: 打开所需的'Zend / Application.php'失败 (include_path中='/无功/网络/虚拟主机/ moderncloud.net / OM /库::/无功/网络/虚拟主机/ moderncloud.net / OM / library:')在/var/www/vhosts/moderncloud.net/om/public/index.php上 第24行
<?php
// Define path to application directory
//defined('APPLICATION_PATH')
// || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', dirname(__FILE__) . '/../application');
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
('/var/www/vhosts/moderncloud.net/om/library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
SOLUTION:
我今天自己找到了。这是一个选项的问题 我的httpd配置中的“php_admin_value open_basedir”。我把它设置为 没有,它开始工作。或者,我想我可以附加Zend库 目录到我的Web服务器配置中的open_basedir选项,而不是将其设置为none。
答案 0 :(得分:0)
你可以尝试更换:
set_include_path(implode(PATH_SEPARATOR, array( ('/var/www/vhosts/moderncloud.net/om/library'), get_include_path(), )));
与
$siteRootDir = dirname($_SERVER['DOCUMENT_ROOT']); set_include_path( $siteRootDir . '/library' . PATH_SEPARATOR . $siteRootDir . '/application' . PATH_SEPARATOR . get_include_path() );
希望它适合你
答案 1 :(得分:0)
如果可能,删除现有的zend框架安装并使用PEAR安装ZF。稍后将更容易更新:
pear channel-discover zend.googlecode.com/svn
pear install zend/zend
它也会使用PEAR的include_path,所以它应该可以解决你的问题。
如果您不能使用pear,请尝试使用包含路径的相对路径:
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
答案 2 :(得分:0)
由于以下原因产生此问题:
或
=&GT;在index.php中复制以下代码并替换它。
<?php
// Define path to application directory
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'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
//require_once 'Zend/Application.php';
require_once 'library/Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();