PDA

View Full Version : fopen access denied



ultra
09-29-2005, 09:03 AM
php script
$file = 'chatlog.php';
$fp = fopen($file, 'a');
fputs($fp, $data);
fclose($fp);

error
Warning: fopen(chatlog.php): failed to open stream: Permission denied in
Warning: fputs(): supplied argument is not a valid stream resource in
Warning: fclose(): supplied argument is not a valid stream resource in

what could have gone wrong?

toml
09-29-2005, 02:06 PM
Make sure your apache has permissions to chatlog.php ( 664, at least ), and that it is owned by apache or at least in the same group as apache is run.

Other things to check for, is that the php.ini directive disable_functions does not list fopen, or the allow_url_fopen directive set to no. Also you might have to make sure php was not compiled with --disable-url-fopen-wrapper. Any of those things will not allow fopen to work properly.