Zend框架Web应用程序没有出现?

时间:2023-02-05 22:57:32

I am trying to get a web app made on Zend Framework up but am encountering this error

我试图在Zend Framework上创建一个Web应用程序,但遇到此错误

Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/worm/index.php on line 17

警告:require_once(Zend / Loader.php)[function.require-once]:无法打开流:第17行/var/www/worm/index.php中没有此类文件或目录

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='/var/worminc/application/../library') in /var/www/worm/index.php on line 17

致命错误:require_once()[function.require]:在/var/www/worm/index.php中打开所需的'Zend / Loader.php'(include_path ='/ var / worminc / application /../ library')失败在第17行

Please suggest the possible solutions?

请建议可能的解决方案?

4 个解决方案

#1


I don't think you've configured your LIB_PATH correctly. At the top of your bootstrap put:

我认为你没有正确配置你的LIB_PATH。在引导程序的顶部放置:

define('LIB_PATH', '/full/path/to/Library'); //Zend Framework is in Library
set_include_path(LIB_PATH . PATH_SEPARATOR . get_include_path());
require_once('Zend/Loader.php');

#2


If the system cannot find something - first you have to find out where it is looking for it.

如果系统找不到东西 - 首先你要找出它在哪里寻找它。

echo get_include_path(), "\n"; die;

Look in the directories it shows, and if the directory 'Zend/' is not there, you know what is wrong.

查看它显示的目录,如果目录'Zend /'不在那里,你就知道出了什么问题。

#3


Be aware that when adding the ZF path to your include_path, you must ensure that you really add the path instead of just overwrite the current include path.

请注意,在向include_path添加ZF路径时,必须确保实际添加路径而不是仅覆盖当前包含路径。

From the text in your errors it looks like you've overwritten the current directory from your include path. The correct way is to do it like karim79 said:

从错误中的文本看起来,您已从include路径覆盖了当前目录。正确的方法是像karim79那样说:

set_include_path($PATH_TO_ZEND_FRAMEWORK . PATH_SEPARATOR . get_include_path());

This is really not an answer, just a tip ;-)

这真的不是一个答案,只是一个提示;-)

#4


The web server also needs read access to the folder, so make sure it can read from it.

Web服务器还需要对该文件夹的读访问权限,因此请确保它可以从中读取。

#1


I don't think you've configured your LIB_PATH correctly. At the top of your bootstrap put:

我认为你没有正确配置你的LIB_PATH。在引导程序的顶部放置:

define('LIB_PATH', '/full/path/to/Library'); //Zend Framework is in Library
set_include_path(LIB_PATH . PATH_SEPARATOR . get_include_path());
require_once('Zend/Loader.php');

#2


If the system cannot find something - first you have to find out where it is looking for it.

如果系统找不到东西 - 首先你要找出它在哪里寻找它。

echo get_include_path(), "\n"; die;

Look in the directories it shows, and if the directory 'Zend/' is not there, you know what is wrong.

查看它显示的目录,如果目录'Zend /'不在那里,你就知道出了什么问题。

#3


Be aware that when adding the ZF path to your include_path, you must ensure that you really add the path instead of just overwrite the current include path.

请注意,在向include_path添加ZF路径时,必须确保实际添加路径而不是仅覆盖当前包含路径。

From the text in your errors it looks like you've overwritten the current directory from your include path. The correct way is to do it like karim79 said:

从错误中的文本看起来,您已从include路径覆盖了当前目录。正确的方法是像karim79那样说:

set_include_path($PATH_TO_ZEND_FRAMEWORK . PATH_SEPARATOR . get_include_path());

This is really not an answer, just a tip ;-)

这真的不是一个答案,只是一个提示;-)

#4


The web server also needs read access to the folder, so make sure it can read from it.

Web服务器还需要对该文件夹的读访问权限,因此请确保它可以从中读取。