code(located in /var/www/html/fileio_test/io_test.php):
<?php
$logging = <<< LOG
This is a test
LOG;
$testfile = fopen('/home/djameson/test.txt','a'); // append mode
fwrite ($testfile, $logging);
fclose($testfile);
?>
test.txt(in /home/djameson/test.txt):
-rwxrw-r--. 1 apache apache 0 Feb 28 20:21 test.txt
Errors:
Warning: fopen(/home/djameson/test.txt): failed to open stream: Permission denied in /var/www/html/fileio_test/io_test.php on line 7
Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/html/fileio_test/io_test.php on line 8
Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/html/fileio_test/io_test.php on line 9
Been at this for a number of days changing around file permissions, adding test.txt to different groups but I have not been able to write to a file. Any ideas?
The results of sestatus:
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
Additional Information:
The server runs on fedora 20; apache server located /var/www