Any help debugging the below would help greatly :)

ok, I ran strace and tried this via a command line:
bash-2.05$ strace ./tmp.php

A snippet from tmp.php looks like this:

#####################################################
#!/usr/local/bin/php -q
<?php

$fopen = fopen("http://www.php.net/";, "r");
exit;
#####################################################

This was the output from the strace.

execve("./tmp.php", ["./tmp.php"], [/* 21 vars */]) = 0
__sysctl([hw.pagesize], 2, "\0\20\0\0", [4], NULL, 0) = 0
mmap(0, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0) = 0x2813e000

geteuid(0xbfbffaec)                     = 1000
getuid()                                = 1000 (euid 1000)
getegid(0xbfbffaec)                     = 1000
getgid()                                = 1000 (egid 1000)
open("/var/run/ld-elf.so.hints", O_RDONLY) = 3
read(3, "Ehnt\1\0\0\0\200\0\0\0a\0\0\0\0\0\0\0`\0\0\0\0\0\0\0\0"..., 128) =
128
lseek(3, 128, SEEK_SET)                 = 128
read(3, "/usr/lib:/usr/lib/compat:/usr/X1"..., 97) = 97
close(3)                                = 0
access("/usr/lib/libpam.so.1", F_OK)    = 0
open("/usr/lib/libpam.so.1", O_RDONLY)  = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=34588, ...}) = 0
read(3, "\177ELF\1\1\1\tFreeBSD\0\3\0\3\0\1\0\0\0\344\30\0\0004"..., 4096) =
4096
mmap(0, 36864, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x28146000
mmap(0x2814e000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x7000)
= 0x2814e000
close(3)                                = 0
access("/usr/lib/libcrypt.so.2", F_OK)  = 0
open("/usr/lib/libcrypt.so.2", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=11680, ...}) = 0
read(3, "\177ELF\1\1\1\tFreeBSD\0\3\0\3\0\1\0\0\0\304\7\0\0004\0"..., 4096) =
4096
mmap(0, 86016, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x2814f000
mmap(0x28152000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x2000)
= 0x28152000
mmap(0x28153000, 69632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANON,
-1, 0) = 0x28153000
close(3)                                = 0
access("/usr/lib/libm.so.2", F_OK)      = 0
open("/usr/lib/libm.so.2", O_RDONLY)    = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=118928, ...}) = 0
read(3, "\177ELF\1\1\1\tFreeBSD\0\3\0\3\0\1\0\0\0\2302\0\0004\0"..., 4096) =
4096
mmap(0, 110592, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x28164000
mmap(0x2817b000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x16000) = 0x2817b000
close(3)                                = 0
access("/usr/lib/libc.so.4", F_OK)      = 0
open("/usr/lib/libc.so.4", O_RDONLY)    = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=561580, ...}) = 0
read(3, "\177ELF\1\1\1\tFreeBSD\0\3\0\3\0\1\0\0\0\274*\1\0004\0"..., 4096) =
4096
mmap(0, 614400, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x2817f000
mmap(0x281fc000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x7c000) = 0x281fc000
mmap(0x28201000, 81920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANON,
-1, 0) = 0x28201000
close(3)                                = 0
sigaction(SIGILL, {0x2812f084, [], 0}, {SIG_DFL}) = 0
sigprocmask(SIG_BLOCK, NULL, [])        = 0
sigaction(SIGILL, {SIG_DFL}, NULL)      = 0
sigprocmask(SIG_BLOCK, ~[ILL TRAP ABRT EMT FPE BUS SEGV SYS], []) = 0
sigprocmask(SIG_SETMASK, [], NULL)      = 0
sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}) = 0
sigprocmask(SIG_BLOCK, NULL, [])        = 0
readlink("/etc/malloc.conf", 0xbfbff8b4, 63) = -1 ENOENT (No such file or
directory)
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0) = 0x28215000
break(0x814b000)                        = 0
break(0x814c000)                        = 0
break(0x814d000)                        = 0
break(0x814e000)                        = 0
break(0x814f000)                        = 0
break(0x8150000)                        = 0
break(0x8151000)                        = 0
open("./php.ini", O_RDONLY)             = -1 ENOENT (No such file or
directory)
open("/usr/local/lib/php.ini", O_RDONLY) = -1 ENOENT (No such file or
directory)
break(0x8152000)                        = 0
break(0x8153000)                        = 0
break(0x8154000)                        = 0
break(0x8155000)                        = 0
break(0x8156000)                        = 0
break(0x8157000)                        = 0
break(0x8158000)                        = 0
break(0x8159000)                        = 0
break(0x815a000)                        = 0
break(0x815b000)                        = 0
break(0x815c000)                        = 0
break(0x815d000)                        = 0
break(0x815e000)                        = 0
break(0x815f000)                        = 0
break(0x8160000)                        = 0
break(0x8161000)                        = 0
break(0x8162000)                        = 0
break(0x8163000)                        = 0
break(0x8164000)                        = 0
break(0x8165000)                        = 0
break(0x8166000)                        = 0
break(0x8167000)                        = 0
break(0x8168000)                        = 0
break(0x8169000)                        = 0
break(0x816a000)                        = 0
break(0x816b000)                        = 0
break(0x816c000)                        = 0
break(0x816d000)                        = 0
break(0x816e000)                        = 0
open("/etc/protocols", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=5770, ...}) = 0
break(0x8170000)                        = 0
read(3, "#\n# Internet protocols\n#\n# $Free"..., 8192) = 5770
close(3)                                = 0
open("/etc/protocols", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=5770, ...}) = 0
read(3, "#\n# Internet protocols\n#\n# $Free"..., 8192) = 5770
close(3)                                = 0
break(0x8171000)                        = 0
break(0x8172000)                        = 0
open("/etc/services", O_RDONLY)         = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=72301, ...}) = 0
break(0x8174000)                        = 0
read(3, "#\n# Network services, Internet s"..., 8192) = 8192
read(3, "TSAP Class 0\niso-tsap\t102/udp\t  "..., 8192) = 8192
read(3, "ing\t\t\nat-3\t\t203/tcp\t   #AppleTal"..., 8192) = 8192
read(3, "s\nups\t\t401/tcp\t   #Uninterruptib"..., 8192) = 8192
read(3, "in\t534/udp\t   #MegaMedia Admin\ni"..., 8192) = 8192
read(3, "tl_bootc\t1068/tcp   #Installatio"..., 8192) = 8192
read(3, "\t\t1429/tcp   #Hypercom NMS\t\t    "..., 8192) = 8192
read(3, "\t1534/udp\nampr-info\t1535/tcp\namp"..., 8192) = 8192
read(3, "33/udp   #DEC Notes\nrsvp-encap\t3"..., 8192) = 6765
read(3, "", 8192)                       = 0
close(3)                                = 0
break(0x8175000)                        = 0
break(0x8176000)                        = 0
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={30, 0}}, NULL) = 0
sigaction(SIGPROF, {0x80c84c4, [], SA_RESTART}, {SIG_DFL}) = 0
sigprocmask(SIG_UNBLOCK, [PROF], NULL)  = 0
break(0x8177000)                        = 0
break(0x8178000)                        = 0
break(0x8179000)                        = 0
break(0x817a000)                        = 0
gettimeofday({999235401, 414103}, NULL) = 0
getpid()                                = 58490 (ppid 58489)
getpid()                                = 58490 (ppid 58489)
open("./tmp.php", O_RDONLY)             = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=1945, ...}) = 0
chdir(".")                              = 0
fstat(3, {st_mode=S_IFREG|0755, st_size=1945, ...}) = 0
break(0x817c000)                        = 0
read(3, "#!/usr/local/bin/php -q\n<?php\n\n/"..., 8192) = 1945
sigprocmask(SIG_BLOCK, NULL, [])        = 0
break(0x8181000)                        = 0
ioctl(3, TIOCGETA, 0xbfbfe84c)          = -1 ENOTTY (Inappropriate ioctl for
device)
break(0x8182000)                        = 0
read(3, "", 8192)                       = 0
break(0x8186000)                        = 0
break(0x8196000)                        = 0
ioctl(3, TIOCGETA, 0xbfbfd898)          = -1 ENOTTY (Inappropriate ioctl for
device)
break(0x819b000)                        = 0
close(3)                                = 0
gettimeofday({999235401, 421434}, NULL) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(5, 0), ...}) = 0
ioctl(1, TIOCGETA, {B9600 opost isig icanon echo ...}) = 0
write(1, "<br>\n", 5<br>
)                   = 5
write(1, "<b>Warning</b>:  Cannot send ses"..., 108<b>Warning</b>:  Cannot
send session cookie - headers already sent in <b>./tmp.php</b> on line
<b>5</b><br>
) = 108
write(1, "<br>\n", 5<br>
)                   = 5
write(1, "<b>Warning</b>:  Cannot send ses"..., 147<b>Warning</b>:  Cannot
send session cache limiter - headers already sent (output started at
./tmp.php:5) in <b>./tmp.php</b> on line <b>5</b><br>
) = 147
open("/tmp/sess_e4761f15ea219adcc61fa75fc23e3931", O_RDWR) = -1 ENOENT (No
such file or directory)
open("/tmp/sess_e4761f15ea219adcc61fa75fc23e3931", O_RDWR|O_CREAT|O_EXCL,
0600) = 3
flock(3, LOCK_EX)                       = 0
fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
lseek(3, 0, SEEK_SET)                   = 0
read(3, "", 0)                          = 0
gettimeofday({999235401, 444693}, NULL) = 0
open("/etc/host.conf", O_RDONLY)        = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=205, ...}) = 0
read(4, "# $FreeBSD: src/etc/host.conf,v "..., 8192) = 205
read(4, "", 8192)                       = 0
close(4)                                = 0
open("/etc/hosts", O_RDONLY)            = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=1115, ...}) = 0
read(4, "# $FreeBSD: src/etc/hosts,v 1.11"..., 8192) = 1115
read(4, "", 8192)                       = 0
close(4)                                = 0
gettimeofday({999235401, 449289}, NULL) = 0
getpid()                                = 58490 (ppid 58489)
issetugid(0x281ffea8)                   = 0
open("/etc/resolv.conf", O_RDONLY)      = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=47, ...}) = 0
read(4, "domain\txanthusinc.com\nnameserver"..., 8192) = 47
read(4, "", 8192)                       = 0
close(4)                                = 0
issetugid(0x281ffea8)                   = 0
kqueue(0x281ffea8)                      = 4
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 5
connect(5, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("209.191.146.3")}}, 16) = 0
sendto(5, " ;\1\0\0\1\0\0\0\0\0\0\3www\3php\3net\0\0\34\0\1", 29, 0, NULL, 0)
= 29
kevent(0x4, 0xbfbf9eb4, 0x1, 0xbfbf9eb4, 0x1, 0xbfbf9ea0) = 1
recvfrom(5, " ;\201\200\0\1\0\1\0\1\0\0\3www\3php\3net\0\0\34\0\1\300"...,
1024, 0, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("209.191.146.3")}}, [16]) = 100
close(5)                                = 0
close(4)                                = 0
kqueue(0x281ffea8)                      = 4
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 5
connect(5, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("209.191.146.3")}}, 16) = 0
sendto(5, " <\1\0\0\1\0\0\0\0\0\0\3www\3php\3net\0\0\1\0\1", 29, 0, NULL, 0) =
29
kevent(0x4, 0xbfbf9eb4, 0x1, 0xbfbf9eb4, 0x1, 0xbfbf9ea0) = 1
recvfrom(5, " <\201\200\0\1\0\2\0\4\0\4\3www\3php\3net\0\0\1\0\1\300"...,
1024, 0, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("209.191.146.3")}}, [16]) = 214
close(5)                                = 0
close(4)                                = 0
open("/etc/hosts", O_RDONLY)            = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=1115, ...}) = 0
read(4, "# $FreeBSD: src/etc/hosts,v 1.11"..., 8192) = 1115
read(4, "", 8192)                       = 0
close(4)                                = 0
kqueue(0x281ffea8)                      = 4
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 5
connect(5, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("209.191.146.3")}}, 16) = 0
sendto(5, " =\1\0\0\1\0\0\0\0\0\0\3www\3php\3net\0\0\34\0\1", 29, 0, NULL, 0)
= 29
kevent(0x4, 0xbfbf9eb4, 0x1, 0xbfbf9eb4, 0x1, 0xbfbf9ea0) = 1
recvfrom(5, " =\201\200\0\1\0\1\0\1\0\0\3www\3php\3net\0\0\34\0\1\300"...,
1024, 0, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("209.191.146.3")}}, [16]) = 100
close(5)                                = 0
close(4)                                = 0
kqueue(0x281ffea8)                      = 4
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 5
connect(5, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("209.191.146.3")}}, 16) = 0
sendto(5, " >\1\0\0\1\0\0\0\0\0\0\3www\3php\3net\0\0\1\0\1", 29, 0, NULL, 0) =
29
kevent(0x4, 0xbfbf9eb4, 0x1, 0xbfbf9eb4, 0x1, 0xbfbf9ea0) = 1
recvfrom(5, " >\201\200\0\1\0\2\0\4\0\4\3www\3php\3net\0\0\1\0\1\300"...,
1024, 0, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("209.191.146.3")}}, [16]) = 214
close(5)                                = 0
close(4)                                = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
connect(4, {sin_family=AF_INET, sin_port=htons(80),
sin_addr=inet_addr("208.247.106.187")}}, 16) = 0
sendto(4, "GET / HTTP/1.0\r\n", 16, 0, NULL, 0) = 16
sendto(4, "Host: www.php.net\r\n", 19, 0, NULL, 0) = 19
sendto(4, "User-Agent: PHP/4.0.6\r\n\r\n", 25, 0, NULL, 0) = 25
select(5, [4], NULL, NULL, NULL)        = 1 (in [4])
recvfrom(4, "HTTP/1.1 200 OK\r\nDate: Fri, 31 A"..., 8192, 0, NULL, NULL) =
1460
sigprocmask(SIG_SETMASK, [], NULL)      = 0
sigprocmask(SIG_BLOCK, NULL, [])        = 0
sigprocmask(SIG_BLOCK, NULL, [])        = 0
sigprocmask(SIG_BLOCK, NULL, [])        = 0
sigprocmask(SIG_BLOCK, NULL, [])        = 0
ftruncate(3, 0)                         = 0
lseek(3, 0, SEEK_SET)                   = 0
write(3, "", 0)                         = 0
close(3)                                = 0
sigprocmask(SIG_BLOCK, NULL, [])        = 0
sigprocmask(SIG_BLOCK, NULL, [])        = 0
shutdown(4, 0 /* receive */)            = 0
close(4)                                = 0
shutdown(4, 0 /* receive */)            = -1 EBADF (Bad file descriptor)
sigprocmask(SIG_BLOCK, NULL, [])        = 0
sigprocmask(SIG_BLOCK, NULL, [])        = 0
sigprocmask(SIG_BLOCK, NULL, [])        = 0
sigprocmask(SIG_BLOCK, NULL, [])        = 0
break(0x8192000)                        = 0
sigprocmask(SIG_BLOCK, NULL, [])        = 0
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0
sigprocmask(SIG_BLOCK, ~[ILL TRAP ABRT EMT FPE BUS SEGV SYS], []) = 0
sigprocmask(SIG_SETMASK, [], NULL)      = 0
exit(0)                                 = ?


Rasmus Lerdorf wrote:

> Well, try it from the command line and strace it and see which errno the
> socket open call is giving you (you said you weren't a newbie).
>
> -Rasmus
>
> On Fri, 31 Aug 2001, Paul Procacci wrote:
>
> > Hey all,
> >     I've been using php for a long time and never have I had a problem
> > with fopen().  Everytime I try to use fopen, I get some weird error
> > messages.  If I do fopen("http://www.php.net";, "r") - I get this error
> > message: Undefined error:
> > If I try doing
> > fopen("http://www.somehost.com/~myname/somefile.php?var=value";, "r") - I
> > get this message:   Bad file descriptor
> > What the heck is going on here?  I've tried everything, except for
> > submitting a bug report.  I hope someone will have some answers.
> >
> > Thanks,
> > Paul
> >
> >
> >



Rasmus Lerdorf wrote:

> Well, try it from the command line and strace it and see which errno the
> socket open call is giving you (you said you weren't a newbie).
>
> -Rasmus
>
> On Fri, 31 Aug 2001, Paul Procacci wrote:
>
> > Hey all,
> >     I've been using php for a long time and never have I had a problem
> > with fopen().  Everytime I try to use fopen, I get some weird error
> > messages.  If I do fopen("http://www.php.net";, "r") - I get this error
> > message: Undefined error:
> > If I try doing
> > fopen("http://www.somehost.com/~myname/somefile.php?var=value";, "r") - I
> > get this message:   Bad file descriptor
> > What the heck is going on here?  I've tried everything, except for
> > submitting a bug report.  I hope someone will have some answers.
> >
> > Thanks,
> > Paul
> >
> >
> >


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to