Permission denied when opening localhost

我与影子孤独终老i 提交于 2019-12-10 03:21:23

问题


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.


回答1:


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:


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



来源:https://stackoverflow.com/questions/15596020/permission-denied-when-opening-localhost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!