By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

How to solve a problem where PHP complains about failing to open a stream.

Edited: 2013-04-24 21:58

The below PHP error may be due to miss-configued file permissions in linux.

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

The error will show up if Apache doesn't have the nessecery permissions to read a file in a given directory. The error may also be followed by another message, telling something about the include path – which most likely doesn't make much sense to you. I.e.

... (include_path='.:/opt/lampp/lib/php') in Unknown on line 0

To solve the problem, you may use the chmod command to change the permissions of your htdocs, like shown below.

sudo chmod -R 0755 /opt/lampp/htdocs