m6w6 / ext-http

Extended HTTP Support
BSD 2-Clause "Simplified" License
79 stars 22 forks source link

PHP without --with-curl: PHP Notice: http\Client::enqueue(): Could not set option proxy_service_name #39

Closed rcanavan closed 8 years ago

rcanavan commented 8 years ago

If PHP was built without the curl extension (i.e. --without-curl or --disable-all without --with-curl), even a simple pecl_http test program emits a warning:

PHP Notice: http\Client::enqueue(): Could not set option proxy_service_name (An unknown option was passed in to libcurl)

I'm using stock pecl_http-3.0.1 with PHP 7.0.5.

m6w6 commented 8 years ago

Hey! Thanks for the report.

This option is wrapped in #if PHP_HTTP_CURL_VERSION(7,43,0).

Nothing in pecl_http depends on ext/curl, this is a pretty-hard-to-beat-to-death myth.

What could be the reason for you this to happen, though, is that PHP links to a different libcurl, i.e. it includes headers for curl >= 7.43 but links to libcurl.so < 7.43

Looking at phpinfo() output might give a hint.

m6w6 commented 8 years ago

E.g:

$ ./sapi/cli/php -i | grep -A10 "HTTP Support"                                                      0 ↵ Tue, 10:58 •
HTTP Support => enabled
Extension Version => 3.0.1dev

Used Library => Compiled => Linked
libz => 1.2.8 => 1.2.8
libcurl => 7.47.1 => 7.47.1
libevent => 2.0.22-stable => 2.0.22-stable
libidn (IDNA2003) => 0.29 => unknown

Directive => Local Value => Master Value
http.etag.mode => crc32b => crc32b
rcanavan commented 8 years ago

There's no curl in my PHP, and no extension except pecl_http links against libcurl.so. The Installed curl version around here is 7.47.0-1ubuntu2, and I've tried to point --with-http-libcurl-dir= to a libcurl that 7.48.0 that is not in the default library search path, but pecl_http seems to pick it up correctly:

$ ldd ~/lib/php-ext/http.so | grep curl
libcurl.so.4 => ~/src/curl48/lib/libcurl.so.4 (0x00007ff7dd04f000)

$ php -i | grep -i curl
libcurl => 7.48.0 => 7.48.0
$ ldd `which php` | grep -i curl
$ 

$ php -i | grep -A10 "HTTP Support"  
HTTP Support => enabled
Extension Version => 3.0.1

Used Library => Compiled => Linked
libz => 1.2.8 => 1.2.8
libcurl => 7.48.0 => 7.48.0
libevent => disabled => disabled
libidn (IDNA2003) => 0.29.1 => unknown

Directive => Local Value => Master Value
http.etag.mode => crc32b => crc32b
m6w6 commented 8 years ago

Okay, just checked the curl sources, seems that this option is only available if libcurl was built with GSSAPI support.

rcanavan commented 8 years ago

If It were not for the output of php -i claiming that both curl versions were 7.48.0, I'd assume that the RPATH in http.so is evaluated at lower priority than the one in the php binary, causing the system curl 7.47.0 to be loaded / used to resolve the symbols in http.so.

Indeed this problem only occurs if I build pecl_http against the curl 7.48.0 which does #undef HAVE_GSSAPI

rcanavan commented 8 years ago

Building curl 7.48.0 with GSS support does indeed prevents the Could not set option proxy_service_name notice.

m6w6 commented 8 years ago

Okay, thank you for verification.