Bug #74483 [Opn->Fbk]: stream_socket_client fails without hosts entry
| From: | daverandom@php.net | Date: | Thu, 20 Apr 2017 20:54:27 +0000 |
| Subject: | Bug #74483 [Opn->Fbk]: stream_socket_client fails without hosts entry | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208696@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74483&edit=1
ID: 74483
Updated by: daverandom@php.net
Reported by: imacarthur at moditcms dot com
Summary: stream_socket_client fails without hosts entry
-Status: Open
+Status: Feedback
Type: Bug
Package: Apache related
Operating System: Fedora 25
PHP Version: 7.0.18
Block user comment: N
Private report: N
New Comment:
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
This appears to be an issue with your server rather than an issue with PHP.
Please user resources like stackoverflow.com and serverfault.com to resolve this issue.
Previous Comments:
------------------------------------------------------------------------
[2017-04-20 20:35:06] spam2 at rhsoft dot net
> 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
and how is that a PHP issue?
you apache environment runs in some weird chroot and can't resolve DNS names - fix your setup
------------------------------------------------------------------------
[2017-04-20 20:28:53] imacarthur at moditcms dot com
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 this bug report at https://bugs.php.net/bug.php?id=74483&edit=1