Does the file already exist? It's not enough to change the directory
permissions, you also have to change it on the file if it exists, and
all of the folders above it, so that apache can get to the file. In
order for PHP to open or create this file, the user that apache runs as
must have permission to the folder and file.

---John Holmes...

> -----Original Message-----
> From: Jason Teagle [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 31, 2002 4:35 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Writing Files (Unix, Apache, PHP 4.0.X) [Newbie Alert]
> 
> I'm trying to open a file for writing using
> 
>             $hOutFile = fopen("filename.tmp","w");
> 
> but I'm getting "Permission denied". The directory has write
permission
> for
> all user levels. Since this is the root www directory, I also tried
> 
> 
>             $hOutFile = fopen("subdir/filename.tmp","w");
> 
> but this also gave the "Permission denied".
> 
> Can anyone suggest any reasons why this might happen? Do some hosts
not
> allow programs to write files like this? Database updates only?
> 
> I see a note at http://www.php.net/manual/en/function.fopen.php saying
> "check your Apache permissions..." - forgive me for being an idiot,
but
> how
> do I do that? {:v)
> 
> 
> --
> --------------------------------------------
> _ _
> o o    Jason Teagle
>  <      [EMAIL PROTECTED]
>  v
> --------------------------------------------
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to