5

I've installed PHP's pecl_http extension using the Amazon Linux php54-pecl-http Yum package.

  • php -i shows the http.ini file loaded
  • http.ini has the extension=http.so line in it
  • php -m shows the HTTP module as installed
  • pecl list shows pecl_http 2.0.0beta1 as installed.

However, when I attempt to use any of its functions - new HttpRequest(), http_build_url(), etc. - they come back as nonexistent. I am running everything on the CLI (this is a utility server) so no chance of disparate php.ini files between environments.

php -i's http block states:

http

HTTP Support => enabled
Extension Version => 2.0.0beta1

Used Library => Compiled => Linked
libz => 1.2.5 => 1.2.5
libcurl => 7.24.0 => 7.24.0
libevent => 1.4 or greater => 2.0.18-stable
libserf => disabled => disabled

                            Persistent Handles                            
Provider => Ident => Used => Free
http_client.curl => N/A => 0 => 0
http_client_pool.curl => N/A => 0 => 0
http_client_datashare.curl => N/A => 0 => 0

Directive => Local Value => Master Value
http.etag.mode => crc32b => crc32b
http.persistent_handle.limit => -1 => -1

Has anyone experienced this? Any ideas?

ceejayoz
  • 32,469
  • 7
  • 81
  • 105

2 Answers2

3

Maybe a little late, but perhaps this helps someone else landing here...

Insure that you are referencing the correct version of the pecl_http API. They moved to namespaces in v2, so the calling convention is quite different. Much of the documentation around on the web references methods in v1.

http://devel-m6w6.rhcloud.com/mdref/http

J. Paulding
  • 366
  • 3
  • 8
1

Please try

strace -fF -o /tmp/wtf php your_php_script.php

And then comb through /tmp/wtf file with a text editor/viewer/grep variant of your choice to see 1) proper php.ini was read and 2) if http.so extension was actually loaded.

Janne Pikkarainen
  • 31,454
  • 4
  • 56
  • 78