PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work
| From: | sniper@php.net | Date: | Sun, 31 Dec 2000 00:55:06 +0000 |
| Subject: | PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-42590@lists.php.net to get a copy of this message | ||
ID: 7880
Updated by: sniper
Reported By: Alan@Halachmi.net
Old-Status: Feedback
Status: Closed
Bug Type: *URL Functions
Assigned To: jason@php.net
Comments:
No feedback. Reopen if this really doesn't work with correct url.
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2000-11-20 11:45:08] jason@php.net
Ya you should be looking up index.php as hholzgra suggests,
but in looking at your truss output, It is behaving as if url wrappers was compiled out.
Can you try this test?
1. Lets verify the source is compiled correctly.
add --enable-debug to your php configure.
a. Remake and make sure that gcc is being called with -g. b. do a gdb httpd
c. run -X
d. hit ctrl-c (it might take a while to catch)
e. break php_fopen_wrapper
f. cont
g. open your test-script while its waiting
h. it should break when it trys to make the file request
i. hit n to step to the next line of code
j. see if it ever hits if(!(options & IGNORE_URL)){
k. if url wrappers is not compiled you would get
if (options & USE_PATH........ instead
---------------------------------------------------------------------------
[2000-11-20 10:22:12] hholzgra@php.net
ooops, looks like this was to early in the morning :(
but it might still be of interest what the output and
error messages look like if you take your code snippet
and just replace the '$fp=file($url)' line with '$fp=fopen($url,"r")'
it seems like file() fails to open the URL but still tries
to read from the file handle that is not valid in this case,
so that 'bad file number' is reported instead of the real cause
if failure ...
PS: i don't think this is realy related to it, but www.php.net/index.html
does not exist. trying to GET it will result in a 404 status and an
error page showing some search results, you should try
www.php.net/index.php instead, just to be sure ...
---------------------------------------------------------------------------
[2000-11-20 09:54:13] jason@php.net
Actually he is using the correct usage. File takes a string calls fopen-wrappers to open a fp, and
then returns an array
Alan, I will see If I can reproduce your findings
-Jason
---------------------------------------------------------------------------
[2000-11-20 07:01:04] hholzgra@php.net
$url = "http://www.php.net/index.html";
$fp = file($url);
is simply wrong usage, try
$url = "http://www.php.net/index.html";
$fp = fopen($url,"r");
$file_contents = file($fp);
instead
---------------------------------------------------------------------------
[2000-11-20 04:40:48] Alan@Halachmi.net
More interesting information... It appears that the outbound connection is never actually made...
This is from a truss of an fopen on www.php.net:
14354/1: resolvepath("/home/pkw/devilnet/v1.0/dev/htdocs/filetest.php",
"/home/pkw/devilnet/v1.0/dev/htdocs/filetest.php", 1024) = 47
14354/1: ioctl(6, TCGETA, 0xFFBEE33C) Err#25 ENOTTY
14354/1: fstat64(6, 0xFFBECBD0) = 0
14354/1: d=0x02200007 i=275213 m=0100644 l=1 u=1001 g=4 sz=283
14354/1: at = Nov 20 04:21:57 EST 2000 [ 974712117 ]
14354/1: mt = Nov 20 03:55:45 EST 2000 [ 974710545 ]
14354/1: ct = Nov 20 03:55:45 EST 2000 [ 974710545 ]
14354/1: bsz=8192 blks=2 fs=ufs
14354/1: ioctl(6, TCGETA, 0xFFBECB5C) Err#25 ENOTTY
14354/1: read(6, " < ?nt $ u r l = "".., 8192) = 283
14354/1: read(6, 0x00303264, 8192) = 0
14354/1: ioctl(6, TCGETA, 0xFFBECC34) Err#25 ENOTTY
14354/1: llseek(6, 0, SEEK_CUR) = 283
14354/1: close(6) = 0
14354/1: so_socket(2, 1, 0, "", 1) = 6
14354/1: connect(6, 0x001378B8, 16, 1) = 0
14354/1: AF_INET name = 127.0.0.1 port = 53
14354/1: send(6, "96 g01