I edited the apache httpd.conf file recently for the mod_rewrite to work. I don\'t know if this problem originated from that or not, but i\'m getting this problem from that
Just quote for above answer of user1992554 This one worked perfectly for me in Linux Mint, to get rid of Warning: failed to open stream: Permission denied
cd /var/www
sudo chown www-data:www-data * -R
sudo usermod -a -G www-data username
Check dos and unix file format. This problem is seen on linux platforms if dos file format is used. Use doc2unix command like below and then retry it should work dos2unix *.php
This solution for below problem
Wed Nov 12 07:50:19 2014] [error] [client IP1] PHP Warning: Unknown: failed to
open stream: Permission denied in Unknown on line 0
[Wed Nov 12 07:50:19 2014] [error] [client IP1] PHP Fatal error: Unknown: Failed
opening required '/var/www/html/index.php' (include_path='.:/usr/share/pear:
/usr/share/php') in Unknown on line 0
It happened to me today with /home/user/public_html/index.php and the solution was to do chmod o+x /home/user
as this directory has to have the X as otherwise the apache server can't list files (i.e. do ls
)
This also happens (and is particularly confounding) if you forgot that you created a Windows symlink to a different directory, and that other directory doesn't have appropriate permissions.
If you are running Fedora, make sure SELinux is not interfering.You fix this with this command:
sudo /sbin/restorecon -R /var/www/.
More info here: linuxquestions.org/questions/linux-server-73/
Once, this happens to me as well. and when I googled the matter, I got to know that this happens when the permissions on the file is wrongfully set to 000 (which means that no one can read, write, or execute that file). Then I just changed my file permission privilege into Read & Write and it's worked for me.
To change file permission settings on mac: Right click on the particular file and click on Get info from dropdown menu and refer to the sharing and permissions panel and change privilege settings into Read & Write
More: http://www.itoctopus.com/warning-unknown-failed-to-open-stream-permission-denied-in-unknown-on-line-0-error-in-joomla