Date: 12/30/00
- Next message: sniper <email protected>: "[PHP-DEV] PHP 4.0 Bug #8493 Updated: Parse Error"
- Previous message: kalowsky <email protected>: "[PHP-DEV] PHP 4.0 Bug #6105 Updated: odbc_pconnect returns 'not a valid ODBC-Link resource'"
- Next in thread: Stig Venaas: "Re: [PHP-DEV] Re: PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work"
- Reply: Stig Venaas: "Re: [PHP-DEV] Re: PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-de>No feedback. Reopen if this really doesn't work with correct url.
I sent an email to jason <email protected> with the following information. I was
unable to update the ticket online with this information for some
reason. This "really doesn't work.":
Date: Sat, 23 Dec 2000 02:34:02 -0500 (EST)
To: jason <email protected>
Subject: PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work
Could you please add this to your PHP bug?
==========================================
Ok - I seem to have tracked this down. I added debug statements throughout
PHP to see exactly where it was failing, and found that it is happening in:
php_network_getaddresses in main/network.c. Basically, in
php_fopen_url_wrap_http in ext/standard/http_fopen_wrapper.c, I modified the
function to let me know where it was bailing:
*socketd = php_hostconnect(resource->host, resource->port, SOCK_STREAM, 0);
if (*socketd == -1) {
php_error(E_WARNING, "php_hostconnect failed");
SOCK_FCLOSE(*socketd);
*socketd = 0;
free_url(resource);
return NULL;
}
It does get to that php_error message, and so after looking through
php_hostconnect, I found that our problem was a failed lookup in
php_network_getaddresses. Here is my slightly modified code that prints out
an error message when getaddrinfo fails:
static int php_network_getaddresses(const char *host, struct sockaddr
***sal)
{
int err;
struct sockaddr **sap;
if (host != NULL) {
#ifdef HAVE_GETADDRINFO
struct addrinfo hints, *res, *sai;
int n;
memset( &hints, '\0', sizeof(hints) );
hints.ai_family = AF_UNSPEC;
if ((err = getaddrinfo(host, NULL, &hints, &res))) {
php_error(E_WARNING, "getaddrinfo failed for host: %s with error: %d",
host, err);
php_error(E_WARNING, gai_strerror(err));
return -1;
}
I took a look at php 4.0.2 (which is working fine for us), and saw that it
doesn't use getaddrinfo for hostname lookups, it uses the gethostbyname
function.
I'm not familiar enough with the getaddrinfo call to tell you if it is
failing because of a bug in Solaris, a problem in our system configuration,
or if it is a problem with the php source.
I have created two testpages that are failing for us, one with a numeric IP
address and another with a hostname that must be resolved. You can view
them here:
Use of the "file" function on a numeric address:
http://pkw.devilnet.duke.edu/testweather.php
Use of the "file" function on a hostname that must be resolved:
http://dev.dspconline.org/scripts/update_weather.php
I hope this helps.
==========================================
Alan
-- Alan Halachmi Wide Area Network Specialist Ingram Entertainment Network Services mailto:alan <email protected> http://www.ingramentertainment.com-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: sniper <email protected>: "[PHP-DEV] PHP 4.0 Bug #8493 Updated: Parse Error"
- Previous message: kalowsky <email protected>: "[PHP-DEV] PHP 4.0 Bug #6105 Updated: odbc_pconnect returns 'not a valid ODBC-Link resource'"
- Next in thread: Stig Venaas: "Re: [PHP-DEV] Re: PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work"
- Reply: Stig Venaas: "Re: [PHP-DEV] Re: PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

