Can't access php files copied into /var/www/ or other folders

梦想的初衷 提交于 2020-01-03 15:38:28

问题


I'm on Ubuntu 12.10 with LAMP setup. I copied a subdirectory which has project files (php, html, css) from xampp/htdocs on my Windows PC into /var/www/ of my ubuntu. However, when I access those files from browser (I can see the directory listing), I get 403 Forbidden on all files within that directory. So I create new dummy php files within that directory just to see if I can access, and it works. Any idea what might be the problem?


回答1:


may be a ownership problem. try do chmod -R 775 /var/www/folder and/or chown -R domain:www-data /var/www/folder - where domain is the user of that particular virtualhost or www-data

for directory listing you may want to modify in /etc/apache2/sites-available/default

+Indexes

see http://www.cyberciti.biz/faq/enabling-apache-file-directory-indexing/




回答2:


This is how I solved the issue:

sudo su
chmod a+rwx /var/www/html/


来源:https://stackoverflow.com/questions/14992802/cant-access-php-files-copied-into-var-www-or-other-folders

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