[PHP-DEV] PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work From: Alan <email protected>
Date: 11/20/00

ID: 7880
User Update by: Alan <email protected>
Status: Open
Bug Type: *URL Functions
Description: PHP_URL_FOPEN doesn't work

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, " < ?\n\t $ 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\0\001\0\0\0\0\0\0".., 29, 0) = 29
14354/1: poll(0xFFBE97F8, 1, 5000) = 1
14354/1: fd=6 ev=POLLRDNORM rev=POLLRDNORM
14354/1: recvfrom(6, "96 g8180\001\0\0\001\0\0".., 1024, 0, 0xFFBE9A00, 0xFFBE9950) = 93
14354/1: AF_INET from = 127.0.0.1 port = 53
14354/1: close(6) = 0
14354/1: open("/etc/hosts", O_RDONLY) = 6
14354/1: fcntl(6, F_SETFD, 0x00000001) = 0
14354/1: fstat64(6, 0xFFBEAFC0) = 0
14354/1: d=0x02200000 i=10689 m=0100444 l=1 u=0 g=3 sz=152
14354/1: at = Nov 20 04:21:57 EST 2000 [ 974712117 ]
14354/1: mt = Sep 16 16:58:39 EDT 2000 [ 969137919 ]
14354/1: ct = Sep 17 14:25:15 EDT 2000 [ 969215115 ]
14354/1: bsz=8192 blks=2 fs=ufs
14354/1: ioctl(6, TCGETA, 0xFFBEAF4C) Err#25 ENOTTY
14354/1: read(6, " #\n # I n t e r n e t".., 8192) = 152
14354/1: read(6, 0x002FF254, 8192) = 0
14354/1: llseek(6, 0, SEEK_CUR) = 152
14354/1: close(6) = 0
14354/1: shutdown(-1, 0, 1) Err#9 EBADF
14354/1: close(-1) Err#9 EBADF
14354/1: alarm(300) = 300
14354/1: alarm(0) = 300
14354/1: chdir("/") = 0
14354/1: umask(022) = 022
14354/1: alarm(0) = 0
14354/1: poll(0xFFBEF808, 1, 0) = 0
14354/1: fd=5 ev=POLLRDNORM rev=0
14354/1: write(5, " H T T P / 1 . 1 2 0 0".., 354) = 354
14354/1: time() = 974712422
14354/1: open("/usr/share/lib/zoneinfo/US/Eastern", O_RDONLY) = 6
14354/1: read(6, " T Z i f\0\0\0\0\0\0\0\0".., 8192) = 1250
14354/1: close(6) = 0
14354/1: write(55, " 1 5 2 . 1 6 . 2 4 8 . 1".., 84) = 84
14354/1: alarm(30) = 0
14354/1: shutdown(5, 1, 1) = 0
14354/1: poll(0xFFBEF680, 1, 2000) = 1
14354/1: fd=5 ev=POLLRDNORM rev=POLLRDNORM
14354/1: read(5, 0xFFBEF7B8, 512) = 0
14354/1: close(5)

--> No connection made to www.php.net
Now... Watch what happens if I substitute the DNS name for the IP:

14377/1: resolvepath("/home/pkw/devilnet/v1.0/dev/htdocs/filetest.php", "/home/pkw/devilnet/v1.0/dev/htdocs/filetest.php", 1024) = 47
14377/1: ioctl(6, TCGETA, 0xFFBEE33C) Err#25 ENOTTY
14377/1: fstat64(6, 0xFFBECBD0) = 0
14377/1: d=0x02200007 i=275213 m=0100644 l=1 u=1001 g=4 sz=287
14377/1: at = Nov 20 04:31:36 EST 2000 [ 974712696 ]
14377/1: mt = Nov 20 04:31:30 EST 2000 [ 974712690 ]
14377/1: ct = Nov 20 04:31:30 EST 2000 [ 974712690 ]
14377/1: bsz=8192 blks=2 fs=ufs
14377/1: ioctl(6, TCGETA, 0xFFBECB5C) Err#25 ENOTTY
14377/1: read(6, " < ?\n\t $ u r l = "".., 8192) = 287
14377/1: read(6, 0x00303264, 8192) = 0
14377/1: ioctl(6, TCGETA, 0xFFBECC34) Err#25 ENOTTY
14377/1: llseek(6, 0, SEEK_CUR) = 287
14377/1: close(6) = 0
14377/1: shutdown(-1, 0, 1) Err#9 EBADF
14377/1: close(-1) Err#9 EBADF
14377/1: alarm(300) = 300
14377/1: alarm(0) = 300
14377/1: chdir("/") = 0
14377/1: umask(022) = 022
14377/1: alarm(0) = 0
14377/1: poll(0xFFBEF808, 1, 0) = 0
14377/1: fd=5 ev=POLLRDNORM rev=0
14377/1: write(5, " H T T P / 1 . 1 2 0 0".., 362) = 362
14377/1: time() = 974712713
14377/1: open("/usr/share/lib/zoneinfo/US/Eastern", O_RDONLY) = 6
14377/1: read(6, " T Z i f\0\0\0\0\0\0\0\0".., 8192) = 1250
14377/1: close(6) = 0
14377/1: write(55, " 1 5 2 . 1 6 . 2 4 8 . 1".., 84) = 84
14377/1: alarm(30) = 0
14377/1: shutdown(5, 1, 1) = 0
14377/1: poll(0xFFBEF680, 1, 2000) = 1
14377/1: fd=5 ev=POLLRDNORM rev=POLLRDNORM
14377/1: read(5, 0xFFBEF7B8, 512) = 0
14377/1: close(5) = 0
14377/1: alarm(0) = 30

--> Note: There still is no outbound connection, even though DNS was taken out of the picture.

Previous Comments:
---------------------------------------------------------------------------

[2000-11-20 04:07:36] Alan <email protected>
1)
truss -feal -o /tmp/output /usr/local/bin/httpd -X
[ Attached as output.tar.gz - Look for filetest.php ]

2)
#gcc -v
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/specs
gcc version 2.95.2 19991024 (release)
                                                                                
#uname -a
SunOS egotist 5.8 Generic_108528-01 sun4u sparc SUNW,Ultra-5_10

3)I've recompiled almost half a dozen times... I've razed the directory and
tar zxvf'ed twice. I'm pretty sure it's a good binary.
                                                                                
php-de>Check your php_config.h to verify that
php-de>#define PHP_URL_FOPEN 1 exists.
                                                                                
--- snip ---
#define DEFAULT_SHORT_OPEN_TAG 1
                                                                                
/* */
#define DEFAULT_SHORT_OPEN_TAG 1
                                                                                
/* */
#define PHP_URL_FOPEN 1
                                                                      
/* */
#define PHP_URL_FOPEN 1
                                                                                
/* Whether you have dmalloc */
/* #undef HAVE_DMALLOC */
--- snip ---

4)
Yup... Worked that way. (under cgi php)

---------------------------------------------------------------------------

[2000-11-20 03:35:27] jason <email protected>
I just noticed your update about the cgi version working. When you build php 4.0.3pl1 for apxs, can you verify
the define statement I listed above exists in php_config.h? I just want to rule out the possibility of a build problem. The other information I requested would be helpful as well

-Jason

---------------------------------------------------------------------------

[2000-11-20 03:19:00] jason <email protected>
Can you try trussing apache in single process mode ( truss ./httpd -X ). Request the script, and see if it actually makes a socket connect request. From your description, it most likely will not.

Also can you give me the details of your compile environment( what make and cc you are using)

Im sure you have thought of this, but is there a possibility of a corrupt build? Have you tried removing config.cache, reconfiguring, and rerunning?

Check your php_config.h to verify that
#define PHP_URL_FOPEN 1 exists.

If all of these check out try building a seperate tree as a standalone cgi, run ./php < test-furl.php and see if you get the same results.

-Jason

---------------------------------------------------------------------------

[2000-11-20 03:11:55] Alan <email protected>
I compiled the CGI version of 4.0.3pl1 and the scripts noted in this bug DOES run in the CGI version.

---------------------------------------------------------------------------

[2000-11-20 02:38:06] jason <email protected>
Sorry, I was wrong, the ini directive did not make 4.0.3pl1
Ill take a look into this.

-Jason

---------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online.

Full Bug description available at: http://bugs.php.net/?id=7880

-- 
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>