dongpanshi2839 2015-01-02 18:11
浏览 81

如何配置lampp使用pecl_http

(running lampp on ubuntu 12.10)

Hi,

I am trying to use the HttpRequest class of pecl_http

my php script is as follows

<?php

        $r = new HttpRequest('http://localhost/test?msg=hello', HttpRequest::METH_GET);
        $r->setOptions(array('lastmodified' => filetime('local.rss')));
        $r->addQueryData(array('category' => 3));
        try{
            $r->send();
            if($r->getResponseCode() == 200){
                file_put_contents('local.rss', $r->getResponseBody());
            }
        }
        catch (HttpException $ex){
            echo $ex;
        }
?>

I have installed pecl_http by doing the following sudo /opt/lampp/bin/pecl install pecl_http

and when running phpinfo() I get the extensions dir to be /opt/lampp/lib/php/extensions/no-debug-non-zts-20131226 and an ls of that folder shows:

aly@krypton:/opt/lampp$ ls -al /opt/lampp/lib/php/extensions/no-debug-non-zts-20131226
total 3208
drwxr-xr-x 2 root root    4096 Jan  2 17:58 .
drwxr-xr-x 3 root root    4096 Jan  2 16:35 ..
-rwxr-xr-x 1 root root 2333400 Jan  2 17:58 http.so
-rwxr-xr-x 1 root root  156824 Nov 17 14:33 oci8.so
-rwxr-xr-x 1 root root  144232 Nov 17 14:33 opcache.so
-rwxr-xr-x 1 root root  132480 Nov 17 14:33 pgsql.so
-rwxr-xr-x 1 root root   72488 Jan  2 17:56 propro.so
-rwxr-xr-x 1 root root   42960 Nov 17 14:33 radius.so
-rwxr-xr-x 1 root root  109746 Jan  2 17:57 raphf.so
-rwxr-xr-x 1 root root   61733 Jan  2 17:55 uploadprogress.so
-rwxr-xr-x 1 root root  203784 Nov 17 14:33 xdebug.so

I have also edited the php.ini located at /opt/lampp/etc/php.ini to have the following lines:

include_path = ".:/php/includes:/opt/lampp/include/php"
extension=propro.so
extension=raphf.so
extension=http.so

But when I load the php I still get the error Class 'HttpRequest' not found

Any ideas?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡等级和折扣规则
    • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
    • ¥100 监控抖音用户作品更新可以微信公众号提醒
    • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
    • ¥70 2048小游戏毕设项目
    • ¥20 mysql架构,按照姓名分表
    • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分