I'm trying to figure out why I can write to and from a text file. This worked fine on my Win2k/Apache server, but when I switched to a Linux/Apache host, i got the following errors:
Code with line numbers:
67 $filename = "password-request-log.txt" ;
68
69 if(!file_exists($filename)){
70 $fd = fopen ($filename , "w+");
71 fclose($fd);
72 }
73
74 $file = file($filename);
75 $file = array_unique($file);
76
77 $fd = fopen ($filename , "r");
78 $fstring = fread ($fd , filesize ($filename)) ;
79 fclose($fd) ;
80 $fd = fopen ($filename , "w");
81 $fcounted = $fstring." ||| ".$host." - ".$IP.":".$port;
82 $fout = fwrite ($fd , $fcounted );
83 fclose($fd);
Errors on load:
Warning: fopen(password-request-log.txt) [function.fopen]: failed to create stream: Permission denied in /home/www/premiercarscompany/admin/lostpassword.php on line 80
Warning: fwrite(): supplied argument is not a valid stream resource in /home/www/premiercarscompany/admin/lostpassword.php on line 82
Warning: fclose(): supplied argument is not a valid stream resource in /home/www/premiercarscompany/admin/lostpassword.php on line 83
Am I missing some syntax? Anyone have any idea how to correct this? Thanks.