Error: [2] require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory
/var/www/vhosts/localhost/httpdocs/public.:./var/www/vhosts/localhost/httpdocs/public/../library:./var/www/vhosts/localhost/httpdocs/public/../model:.
defined('SITE_ROOT') ? null : define('SITE_ROOT',$_SERVER['DOCUMENT_ROOT']);
$includePath[] = '.';
$includePath[] = '.' . SITE_ROOT . '/../library';
$includePath[] = '.' . SITE_ROOT . '/../model';
$includePath[] = get_include_path();
$includePath = implode(PATH_SEPARATOR,$includePath);
set_include_path($includePath);
require_once 'Zend/Loader/Autoloader.php';
请帮我正确设置set_include_path。
答案 0 :(得分:2)
你正在使用这样的行:
$includePath[] = '.' . SITE_ROOT . '/../library';
为您提供一个include_path,例如:
./var/www/vhosts/localhost/httpdocs/public/../library
注意该路径开头的.
- 我猜它不应该在那里。
尝试在每条路径的开头删除.
:
$includePath[] = '.';
$includePath[] = SITE_ROOT . '/../library';
$includePath[] = SITE_ROOT . '/../model';
$includePath[] = get_include_path();
$includePath = implode(PATH_SEPARATOR,$includePath);
set_include_path($includePath);
有关信息:UNIX路径中的.
表示“当前目录”;并且路径开头的/
表示“服务器的根”。
因此,诸如./var/www
之类的路径实际上意味着“位于当前目录”内的www
目录内的var
目录。< / p>
您可能需要类似“www
目录的内容,该目录位于服务器根目录的var
目录中。”