Warning: fopen(newfile.txt): failed to open stream: Permission denied in /var/www/public_html/test.php on line 2
Unable to open file!
fopen gives above error while opening stream for following code
<?php $myfile = fopen("newfile2.txt", "w") or die("Unable to open file!"); $txt = "John Doe\n"; fwrite($myfile, $txt); $txt = "Jane Doe\n"; fwrite($myfile, $txt); fclose($myfile); ?>
solution was labeling the file using following command.
chcon -t httpd_sys_rw_content_t filename
Unable to open file!
fopen gives above error while opening stream for following code
<?php $myfile = fopen("newfile2.txt", "w") or die("Unable to open file!"); $txt = "John Doe\n"; fwrite($myfile, $txt); $txt = "Jane Doe\n"; fwrite($myfile, $txt); fclose($myfile); ?>
solution was labeling the file using following command.
chcon -t httpd_sys_rw_content_t filename