Bug #74483 [NEW]: stream_socket_client fails without hosts entry

From: Date: Thu, 20 Apr 2017 20:28:55 +0000
Subject: Bug #74483 [NEW]: stream_socket_client fails without hosts entry
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208694@lists.php.net to get a copy of this message
From: imacarthur at moditcms dot com Operating system: Fedora 25 PHP version: 7.0.18 Package: Apache related Bug Type: Bug Bug description:stream_socket_client fails without hosts entry Description: ------------ Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/vhosts/vitatree/test.php on line 9 Warning: stream_socket_client(): unable to connect to ssl://pilot-payflowpro.paypal.com:443 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /home/vhosts/vitatree/test.php on line 9 errno :0 message: php_network_getaddresses: getaddrinfo failed: Name or service not known If I add an entry in /etc/hosts for the site it works. Always works from the command line. It's only from within Apache I see the issue. Multiple sites [maps.googleapis.com, fedex.com, even google.com] have the same issue. The name won't resolve without an entry in /etc/hosts. php test.php - works wget //hostname/test.php - fails Actual php version is 7.0.17 Linux ingagedigital.com 4.9.13-200.fc25.x86_64 #1 SMP Mon Feb 27 16:48:42 UTC 2017 x86_64 Apache/2.4.25 (Fedora) OpenSSL/1.0.2k-fips PHP/7.0.17 mod_perl/2.0.10 Perl/v5.24.1 Test script: --------------- <?php $context_opts = array(); $context = stream_context_create($context_opts); $fp = stream_socket_client( "ssl://pilot-payflowpro.paypal.com:443", $errno, $errmsg, 1000, STREAM_CLIENT_CONNECT, $context); echo "errno :".$errno." message: ".$errmsg.PHP_EOL; ?> Expected result: ---------------- errno :0 message: Actual result: -------------- Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/vhosts/vitatree/test.php on line 9 Warning: stream_socket_client(): unable to connect to ssl://pilot-payflowpro.paypal.com:443 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /home/vhosts/vitatree/test.php on line 9 errno :0 message: php_network_getaddresses: getaddrinfo failed: Name or service not known -- Edit bug report at https://bugs.php.net/bug.php?id=74483&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74483&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74483&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74483&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74483&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74483&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74483&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74483&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74483&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74483&r=support Expected behavior: https://bugs.php.net/fix.php?id=74483&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74483&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74483&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74483&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74483&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74483&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74483&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74483&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74483&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74483&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74483&r=mysqlcfg

« previous php.bugs (#208694) next »