【问题标题】:Something wrong with include_path in Zend FrameworkZend 框架中的 include_path 有问题
【发布时间】:2011-01-11 00:12:35
【问题描述】:

收到此错误:

致命错误:require_once() [function.require]:无法打开所需的“db/db.php”(include_path='/home/domain.ru/testerier/sites/application/../library:/home/ domain.ru/testerier/sites/library:.:/usr/local/lib/php;/home/domain.ru/testerier/sites/application/models') 在 /home/domain.ru/testerier/sites/www /index.php 第 51 行

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)).";".realpath(APPLICATION_PATH . '/models'));

它在本地机器上运行良好。怎么了?

【问题讨论】:

    标签: zend-framework include-path


    【解决方案1】:

    你的本地机器是windwos机器,服务器是Linux吗?那么你可能会遇到区分大小写的问题。 Windows 不区分大小写,因此在 Windows 上 Folderfolder 是相同的。在 Linux 上它们不是。也许你的library 实际上是Library 什么的。

    【讨论】:

    • 本地网络服务器在 Windows XP 上。好的,我将尝试使所有内容都小写。我将发布目录树结构的图片。
    • 是的,它似乎区分大小写。但是模型文件夹确实存在一些问题。我已经将它移到了上一层,它现在可以工作了。更改配置:$includePath[] = '.'; $includePath[] = './../models'; $includePath[] = './../library'; $includePath[] = get_include_path(); $includePath = implode(PATH_SEPARATOR,$includePath); set_include_path($includePath);
    • 现在我收到 500 服务器错误代码,因为 .htaccess 中的这些行 天哪,这台服务器出了什么问题...我不擅长配置 .htaccess,请您解释一下,为什么所有这些行都会导致 500 服务器错误? RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d
    • 可能是 mod_rewrite 没有安装/启用。检查你的 Apache 错误日志,它应该会给你更多的线索。
    • 谢谢,我想这就是原因。这是免费托管。
    猜你喜欢
    • 2023-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-31
    • 1970-01-01
    • 2012-08-10
    • 1970-01-01
    相关资源
    最近更新 更多