[clue-tech] I'm blind, or why is this PHP fwrite() failing?

Jed S. Baer thag at frii.com
Sun Sep 25 14:06:39 MDT 2005


Example code: http://us2.php.net/function.fwrite

My code:

    $ptologfile = fopen('/tmp/contactlog.txt', 'a') || die ("Can't open
logfile");
    if (is_writable('/tmp/contactlog.txt')) echo '<b>Writeable</b><br>';
    $junk = 'junk';
    fwrite($ptologfile, $junk) || die ("Can't write to logfile");

Output to web:

Writeable
Can't write to logfile

Output to Apache error log:

fwrite(): supplied argument is not a valid stream resource

$ ls -l /tmp/contactlog.txt 
-rw-r--r--  1 apache apache 0 Sep 25 13:56 /tmp/contactlog.txt

Gotta be missing something obvious, but I can't see it.

I've also tried to put the file in /var/tmp and /var/www/html -- same
results. Ownerships and permissions of directories indicate they should
all be writeable by the webserver process running as user "apache".

Thanks for any help.
jed

-- 
http://s88369986.onlinehome.us/freedomsight/
Key fingerprint = B027 FEFB 4281 CC72 67D1  4237 F2D0 D356 077A A30E
... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier
_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech



More information about the clue-tech mailing list