php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67316 Cannot instantiate \http\Client
Submitted: 2014-05-21 09:03 UTC Modified: 2014-09-15 12:15 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:-1 (-50.0%)
From: php at lornajane dot net Assigned: mike (profile)
Status: No Feedback Package: pecl_http (PECL)
PHP Version: Irrelevant OS: Ubuntu 12.10
Private report: No CVE-ID: None
 [2014-05-21 09:03 UTC] php at lornajane dot net
Description:
------------
I try to create a new \http\Client as per the documentation and it throws an exception.  Passing in "curl" as the only parameter results in exactly the same issue with a slightly different error message.  The curl extension is present and working.  I have stock Ubuntu PHP from saucy (13.30) PHP 5.5.3-1ubuntu2.1

Test script:
---------------
<?php

$client = new http\Client();


Actual result:
--------------
PHP Fatal error:  Uncaught exception 'http\Exception\UnexpectedValueException' with message 'Failed to locate "(null)" client request handler' in /home/.../pecl-testcase.php:3
Stack trace:
#0 /home/.../pecl-testcase.php(3): http\Client->__construct()
#1 {main}
  thrown in /home/.../pecl-testcase.php on line 3

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-21 10:53 UTC] mike@php.net
-Status: Open +Status: Feedback
 [2014-05-21 10:53 UTC] mike@php.net
That old myth that the curl extension has to be present/enabled/loaded/whatever for pecl_http to work is really a though one... :)  It is/was needed on Windows because there were some symbol exporting issues iwht zlib, libcurl and pecl_http, but I think that this is not any longer the case.

pecl_http has to be built with libcurl support for the client to work, i.e. configure output should indicate the appropriate curl headers and libraries were available when compiling the extension.

If you didn't already, apt-get install libcurl3-dev-openssl or something similiar; I don't know the exact name off the top oof my head, and re-install pecl_http (and watch the configure output).

PS: Lorna, you know where to find me on IRC/Twitter/etc... :)
 [2014-05-21 10:53 UTC] mike@php.net
-Assigned To: +Assigned To: mike
 [2014-05-27 10:28 UTC] php at lornajane dot net
Ah, that helps.  Aptitude offers me a package called libcurl3-openssl-dev and installing that and then reinstalling the pecl extension allows me to at least instantiate the object.  Would it be possible to pick that up at configure time?  Let me know if I can test or help more.
 [2014-05-27 12:34 UTC] mike@php.net
Uh, what do you mean by "at least"?
And what should be picked up at configure time?
 [2014-06-02 06:20 UTC] php at lornajane dot net
Let me rephrase my hasty comments.

I can confirm that I can instantiate the object now.  I cannot confirm if anything else works as I haven't had chance to revisit my script - but I wanted to update this bug with at least that minimal information.

My second question is: Could the configure script identify that I was missing a dependency?  From a user perspective I was really surprised to see a successful install reported, and then have the extension unusable.
 [2014-06-02 07:24 UTC] mike@php.net
Well, it actually is everything else than unusable, it's "just" the client functionality that's missing. 

Okay, in most cases, that might be the reason one installed this extension, but it still provides plenty of functionality besides the client.
 [2014-09-15 12:15 UTC] mike@php.net
-Status: Feedback +Status: No Feedback
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 10 09:01:26 2024 UTC