Linux – Why can’t the apache process write to the world-writeable file

apachecgilinuxpermissions

I'm having this problem and I reached a deadlock, I would try anything I've reached a deadend. My problem goes like this:

I have a Perl/CGI script installed on Fedora 9 machine running apache2, this script have a config file which placed in the same directory, this config file has 777 permissions.

The script can't write to the file. It can read but in no way could I get it to write to it. The file is owned by the same user the apache is running. I wrote a small PHP script to test and placed it in the same folder. The PHP script can read but can't write to it.

I'm so desperate here and I don't know where to start with problem, so any help to get me on the right way would be appreciated.

EDIT: I can open the file for editing from command line; it is apache who can't access it

EDIT2: the folder hierarchy /var/www/cgi-bin/script
permissions are like this
/var root 755
www root 755
cgi-bin root 755
script apache 755

EDIT: The problem was in selinux. I disabled it and the script had access to the file thanks for everyone contributed

Thanks in advance

Best Solution

Does apache run with some selinux profile or similar that prevents it writing in that directory?