【问题标题】:How to include the PEAR php packages on a MAC when changed include path in .htaccess如何在 .htaccess 中更改包含路径时在 MAC 上包含 PEAR php 包
【发布时间】:2010-07-13 22:35:27
【问题描述】:

我正在尝试使用 PEAR 的 Text_Password 类,但不确定如何包含它。

我已经安装了 PEAR。而且我猜它已经把类放在 PHP 目录的某个地方。我的 .htaccess 文件中有这个

php_value include_path .:/Library/WebServer/Documents/phpweb20/include

这就是为什么我猜它没有接他们。有谁知道我可以如何包含 PEAR 类?

这是我收到的错误消息:

Warning: include_once(Text/Password.php) [function.include-once]: failed to open stream: No such file or directory in /Library/WebServer/Documents/phpweb20/include/Zend/Loader.php on line 146

Warning: include_once() [function.include]: Failed opening 'Text/Password.php' for inclusion (include_path='.:/Library/WebServer/Documents/phpweb20/include') in /Library/WebServer/Documents/phpweb20/include/Zend/Loader.php on line 146

Fatal error: Class 'Text_Password' not found in /Library/WebServer/Documents/phpweb20/include/DatabaseObject/User.php on line 25

我更改 .htaccess 文件的原因是因为我使用的是 Zend 框架。我将 Zend 类放在包含文件夹中。我可以为 PEAR 做类似的事情吗?

非常感谢!

琼斯

【问题讨论】:

    标签: php zend-framework pear


    【解决方案1】:

    可以设置多个文件夹,见:http://php.net/manual/en/function.set-include-path.php

    示例 2 可能最适合您的需求。您也可以在您的 php ini 文件中执行此操作。

    【讨论】:

    • 感谢您的信息。我尝试添加 $path = '/usr/lib/php/PEAR'; set_include_path(get_include_path() . PATH_SEPARATOR . $path);但似乎仍然不起作用:(我不确定你是否对 PEAR 库了解很多,但我正在尝试使用 Text_Password。我更新了我的代码以显示我收到的错误消息。
    • 得到它的工作,缺少来自 PEAR 的 Text/Password.php 文件。刚刚自己创建了它以及新的包含,它可以工作 - 欢呼阿什利
    猜你喜欢
    • 2012-06-12
    • 2012-03-10
    • 2012-10-29
    • 2012-06-27
    • 2016-04-01
    • 2014-05-08
    • 2011-01-27
    • 2011-02-15
    相关资源
    最近更新 更多