问题描述
当我尝试运行由 Zend Framework 创建的项目时,出现以下错误.它正在寻找 Zend/Application.php,它在我的 include_path 目录中可用.我确实拥有该目录的读取权限.
PHP 致命错误:require_once() [function.require]:无法打开所需的Zend/Application.php"(include_path='/var/www/vhosts/moderncloud.net/om/library:.:/var/www/vhosts/moderncloud.net/om/library:') 在/var/www/vhosts/moderncloud.net/om/public/index.php 上第 24 行
||bootstrap()->运行();
解决方案:
我今天自己找到的.它的选项有问题我的 httpd 配置中的php_admin_value open_basedir".我设置为没有,它开始工作.或者,我想我可以附加 Zend 库将目录添加到我的 Web 服务器配置中的 open_basedir 选项,而不是将其设置为 none.
这个问题产生的原因:
- 在 index.php 文件中的 Public 文件夹内.
或
- 在库文件夹中:- 只需检查库文件夹,库文件夹中是否存在 Zend 文件夹.如果不存在 zend 文件夹,则从 zend 框架下载并保存在库文件夹中.
=> 在 index.php 中复制以下代码并替换它.
||bootstrap()->运行();
I get the following error when I try to run the project created by Zend Framework. Its looking for Zend/Application.php and that is available in the directory that is in my include_path. I do have read permissions on the directory.
<?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:
This problem generated due to :
- Inside Public folder in index.php file.
or
- Inside library folder :- Just check in library folder there is a folder of Zend present in library folder or not.If not present zend folder then download from zend framework and save in library folder.
<?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();
这篇关于Zend 框架错误:无法打开需要“Zend/Application.php"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!