在.php中,我有这个:
Line 64 require_once 'Zend/View/Stream.php'
在apache错误日志中,我看到:[error][client 127.0.0.1]PHP致命错误:require_one():打开必需的"失败(include_path="……
我已经在谷歌上搜索和调试了四个小时。。也许这听起来很熟悉。。我不明白代码行
require_once 'Zend/View/Stream.php'
导致
Failed opening required ''
编辑根据https://bugs.php.net/bug.php?id=62398,在使用PHP 5.4的APC扩展的一些早期版本中存在一个错误,该错误将传递给require
的文件替换为空字符串。
感谢@conseptdeluxe,他在使用PHP 5.4.30和APC 3.1.13时发现了这一点。一个可能的解决方案已被确认为通过配置指令apc.stat=1
(在php.ini
中)启用APC或升级PHP和扩展。
否则
您可能希望按照上的说明更新include_path
配置选项http://php.net/manual/fr/function.set-include-path.php
基本上,需要告诉解释器在哪里查找Zend
类。
假设Zend
库可从/var/www/my_project/vendor/Zend
获得,那么我们可以在使用Zend Stream
:之前进行下一次调用
set_include_path(get_include_path() . PATH_SEPARATOR . '/var/www/my_project/vendor');
另一个解决方案是更改PHP配置文件通过如下更新include_path
值:
# assuming vim is available as text editor
# and PHP configuration file would be available for editing
vim /etc/php.ini
# append /var/www/my_project/vendor to the value of entry
include_path='.:/var/www/my_project/vendor'