|
Posted by Michael on 12/26/05 23:45
I'm having trouble opening a file for writing under Red Hat Fedora
Linux.
Here is the statement:
$fp = fopen("/var/www/html/test01.txt","w");
It generates the following error msg:
fopen(/var/www/html/test01.txt): failed to open stream: Permission
denied in /var/www/html/buildhw.php on line 11
Here are the permission settings for the directories and the file that
I'm trying to open:
drwxrwxrwx 25 root root 4096 Aug 13 12:57 var
drwxrwxrwx 11 root root 4096 Aug 13 13:12 www
drwxrwxrwx 2 root root 4096 Dec 26 13:19 html
-rwxrwxrwx 1 mike mike 22 Dec 26 13:17 test01.txt
Here is some more info:
1. Logging in as root makes no difference - still get the same error.
2. If I change the mode from "w" to "r", fopen works. This tells me
that PHP can at least find the file.
3. I can do an fopen on the same file from C, with a mode of "w", and
it works. This implies that it's not a permission issue, but rather
something in PHP or Apache.
4. The account named "apache" is a member of the groups "mike" and
"root".
I must apologize if this is a silly question; I'm new to Linux, PHP,
and Apache. Any help would be greatly appreciated.
Thanks,
M. McDonnell
[Back to original message]
|