9
votes

I had recently installed Apache, PHP and MySQL in Ubuntu. And copied the files I created to the var/www directory. But when I open http://localhost it is showing

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

Fatal error: Unknown: Failed opening required '/var/www/index.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

How can I run my project normally? It was working fine in windows.

2
Does /var/www/index.php exist?Steve
@Steve yes when i create a php file with echo ¨hai¨ it works.Hari krishnan
check your include path. it's different in windows and linuxuser2193789
Set the permissions on index.php to 777 and see if that helps.Nick Pickering
@NicholasPickering changed to 777 now its working...write it as answer i will acceptHari krishnan

2 Answers

9
votes

According to this article, you need to give read/execute permissions to Owner, Group, and Everyone.

Set permissions on the problem file to 777. Note, you should avoid doing this on a server that's accessible from the internet.

http://webomania.wordpress.com/2007/03/12/permission-denied-in-unknown-on-line-0/

2
votes

To fix this problem, look at the line in your ErrorLog, to find out which folder it is trying to access. If a block already exists for that folder, make sure it is set to allow access as necessary. If not, add a block to your Apache configuration file, allowing access as required. See the example below for folder /usr/local/awstats/htdocs.

Order allow,deny Allow from all

for a complete reference, check the apache wiki