简体   繁体   English

Include_Path Zend_Framework

[英]Include_Path Zend_Framework

    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';

Please help me setting properly set_include_path. 请帮助我正确设置set_include_path。

You are using lines such as this : 您正在使用这样的行:

$includePath[] = '.' . SITE_ROOT . '/../library';

Which get you an include_path such as this : 这将为您提供诸如此类的include_path:

./var/www/vhosts/localhost/httpdocs/public/../library

Note the . 注意. at the beginning of that path -- I'm guessing it shouldn't be there. 在那条道路的开始-我猜它不应该在那里。

Try removing thoses . 尝试删除那些. at the beginning of each path : 在每个路径的开头:

$includePath[] = '.';
$includePath[] = SITE_ROOT . '/../library';
$includePath[] = SITE_ROOT . '/../model';
$includePath[] = get_include_path();
$includePath = implode(PATH_SEPARATOR,$includePath);
set_include_path($includePath);


For information : A . 参考信息: . in a UNIX path means " current directory " ; 在UNIX路径中表示“ 当前目录 ”; and a / at the beginning of a path means " the root of the server ". 路径开头的/表示“ 服务器的根 ”。

So, a path such as ./var/www actually means "the www directory that is inside the var directory that is inside the current directory" . 因此,诸如./var/www的路径实际上意味着“位于当前目录内的var目录内的www目录”

And you probably need something like "the www directory that's inside the var directory that's at the root of the server." 您可能需要类似“位于服务器根目录的var目录中的www目录”之东西

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM