PHP找不到Phpstream类(使用名称空间和PHP5.4.9-4ubuntu2.3)
我使用composer安装了Pear2HTTP库,不幸的是,在使用该库时出现了一个错误(根据原则,但这不重要)PHP找不到Phpstream类(使用名称空间和PHP5.4.9-4ubuntu2.3),php,http,namespaces,zend-framework2,pear,Php,Http,Namespaces,Zend Framework2,Pear,我使用composer安装了Pear2HTTP库,不幸的是,在使用该库时出现了一个错误(根据原则,但这不重要) 这些类是pear2库,因此我强烈希望不要更改它们。我有什么遗漏吗?为什么php找不到类Phpstream?有一个'Request'文件夹和'Request.php'文件这一事实会让事情变得困难吗?条令类加载器使用zend framework类加载器,但我不确定这会产生什么影响。我解决了这个问题,需要在/etc/php5/cli/php.ini中添加“extension=http.so”
这些类是pear2库,因此我强烈希望不要更改它们。我有什么遗漏吗?为什么php找不到类Phpstream?有一个'Request'文件夹和'Request.php'文件这一事实会让事情变得困难吗?条令类加载器使用zend framework类加载器,但我不确定这会产生什么影响。我解决了这个问题,需要在/etc/php5/cli/php.ini中添加“extension=http.so”。我已经为apache2这样做了,但没有为cli这样做(这在ubuntu上是不同的)。我也需要做sudopecl安装-f pecl_http-1.7.6来拥有旧的API。
h@dev0 ~/Repositories/pfo $ vendor/bin/doctrine-module migrations:migrate
# A few statements before the error I included a statement to get the include path: echo ini_get('include_path');
/home/h/Repositories/pfo/vendor/pear-pear2.php.net/PEAR2_Text_Markdown:/home/h/Repositories/pfo/vendor/pear-pear2.php.net/PEAR2_HTTP_Request:.:/usr/share/php:/usr/share/pear
# Afterwards I get this error:
PHP Fatal error: Class 'pear2\HTTP\Request\Adapter\Phpstream' not found in /home/h/Repositories/pfo/vendor/pear-pear2.php.net/PEAR2_HTTP_Request/pear2/HTTP/Request.php on line 98
# And the Phpstream.php does exist, it begins like this:
namespace pear2\HTTP\Request\Adapter;
use pear2\HTTP\Request;
class PhpStream extends Request\Adapter { ... }
# and is located here:
h@dev0 ~/Repositories/pfo $ ls /home/h/Repositories/pfo/vendor/pear-pear2.php.net/PEAR2_HTTP_Request/pear2/HTTP/Request/Adapter/
Curl.php Filesystem.php Http.php Phpsocket.php Phpstream.php
# The Request.php class looks like this, notice that this file is in a folder together with the Request folder for the 'Request\Adapter\Phpstream' class:
namespace pear2\HTTP;
class Request {
....
public function __construct($url = null, $instance = null) {
echo ini_get('include_path');
...
$this->adapter = new Request\Adapter\Phpstream;
...
}
}