Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied when opening localhost

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.

like image 407
Hari krishnan Avatar asked Mar 24 '13 07:03

Hari krishnan


People also ask

How do I fix denied permissions?

Right-click the file or folder, and then click Properties. Click the Security tab. Under Group or user names, click your name to see the permissions you have. Click Edit, click your name, select the check boxes for the permissions that you must have, and then click OK.

Why do I get permission denied Publickey?

"Permission denied (publickey)" and "Authentication failed, permission denied" errors occur if: You're trying to connect using the wrong user name for your AMI. The file permissions within the operating system are incorrect on the instance. The incorrect SSH public key (.

How do I fix permission denied Publickey password?

Solution 1: Enable Password Authentication If you want to use a password to access the SSH server, a solution for fixing the Permission denied error is to enable password login in the sshd_config file. In the file, find the PasswordAuthentication line and make sure it ends with yes .


2 Answers

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/

like image 177
Nick Pickering Avatar answered Oct 04 '22 06:10

Nick Pickering


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

like image 30
fengd Avatar answered Oct 04 '22 07:10

fengd