Re: [PHP] Serious Fopen Problems - not newbie :)
Depending on the version of PHP you're using, this might help: Versions prior to PHP 4.0.5 do not handle HTTP redirects. Because of this, directories must include trailing slashes. It's from the fopen() manual page, http://www.php.net/fopen Cheers - -- - - - Philip Murray - [EMAIL PROTECTED] http://www.open2view.com - Open2View.com - - -- - - > This is a snippet from my code. > > $FILE = "http://www.somehost.com";; > > $fp = fopen($FILE, "r"); > > if(!$fp){ > print("Somethings screwy"); > } > else{ > do stuff > } > > Any suggestions? > > Paul > > Speedboy wrote: > > > > I'm sure http://www.php.net exists. :) > > > > No, what my sentence meant was you're trying to do some operations on a > > mis-typed file descripter? > > > > $fp = fopen... > > fputs($fp2... > > ^- There should be no 2. > > > > Possibly something like that? > > > > > > > > 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 > > > > > > > > You're trying to do operations on a file descripter that doesn't exist? > > > -- > 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] > > -- 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]
Re: [PHP] Serious Fopen Problems - not newbie :)
This is a snippet from my code. $FILE = "http://www.somehost.com";; $fp = fopen($FILE, "r"); if(!$fp){ print("Somethings screwy"); } else{ do stuff } Any suggestions? Paul Speedboy wrote: > > I'm sure http://www.php.net exists. :) > > No, what my sentence meant was you're trying to do some operations on a > mis-typed file descripter? > > $fp = fopen... > fputs($fp2... > ^- There should be no 2. > > Possibly something like that? > > > > > > 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 > > > > > > You're trying to do operations on a file descripter that doesn't exist? -- 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]
Re: [PHP] Serious Fopen Problems - not newbie :)
> I'm sure http://www.php.net exists. :) No, what my sentence meant was you're trying to do some operations on a mis-typed file descripter? $fp = fopen... fputs($fp2... ^- There should be no 2. Possibly something like that? > > > > 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 > > > > You're trying to do operations on a file descripter that doesn't exist? -- 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]
Re: [PHP] Serious Fopen Problems - not newbie :)
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 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(0x815)= 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(0x816)= 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)
Re: [PHP] Serious Fopen Problems - not newbie :)
I'm sure http://www.php.net exists. :) Speedboy wrote: > > > 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 > > You're trying to do operations on a file descripter that doesn't exist? -- 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]
Re: [PHP] Serious Fopen Problems - not newbie :)
> > 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 You're trying to do operations on a file descripter that doesn't exist? -- 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]
Re: [PHP] Serious Fopen Problems - not newbie :)
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]