简体   繁体   English

Zend Framework-如何正确设置包含路径?

[英]Zend Framework - How to Properly set Include Path?

I'm trying to install TheStudio application which was apparently written using Zend Framework. 我正在尝试安装TheStudio应用程序,该应用程序显然是使用Zend Framework编写的。 My test server is running Ubuntu 12.04 and my application directory is stored in /home 我的测试服务器正在运行Ubuntu 12.04,我的应用程序目录存储在/ home中

My error log is stating 我的错误日志说明

PHP Fatal error:  require_once(): Failed opening required 'usr/share/php/libzend-frameworkphp/Zend/Loader/Autoloader.php'   
  (include_path='.:../library:../application/db:../application/models:../application/utils:../application/views/helpers:../application') in /home/application/config/config.php on line 22

Line 22 of config.php states: config.php的第22行指出:

require_once '/usr/share/php/libzend-framework-php/Zend/Loader/Autoloader.php';

The include path is as follows: 包含路径如下:

define('PS',        PATH_SEPARATOR);
define('DS',        DIRECTORY_SEPARATOR);
define('ROOT_DIR',  dirname('home'));

// Modify include path
$paths = '.' . PS . '..' . DS . 'library'
         . PS . '..' . DS . 'application' . DS . 'db'
         . PS . '..' . DS . 'application' . DS . 'models'
         . PS . '..' . DS . 'application' . DS . 'utils'
         . PS . '..' . DS . 'application' . DS . 'views' . DS . 'helpers'
         . PS . '..' . DS . 'application';
ini_set("include_path", $paths);

How should I modify the path statement to target the files located in /home directory? 我应该如何修改path语句以定位/ home目录中的文件? Are there other adjustments that should be made in order to resolve the above error? 为了解决上述错误,还需要进行其他调整吗?

/usr/share/php/libzend-frameworkphp is the default installation path for the Zend Framework Ubuntu package, so it seems this application is assuming that will be there. /usr/share/php/libzend-frameworkphp是Zend Framework Ubuntu软件包的默认安装路径,因此看来此应用程序假定该目录已经存在。 sudo apt-get install zend-framework should solve that problem. sudo apt-get install zend-framework应该可以解决该问题。

I would say it's bad practice to include the full path on a require_once call, and there are way too many include paths being defined on your third code example (which I assume is from the app?). 我会说在require_once调用中包含完整路径是一种不好的做法,并且在您的第三个代码示例中定义了太多包含路径(我认为是来自应用程序的?)。

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

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