简体   繁体   English

无法访问复制到/ var / www /或其他文件夹的php文件

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

I'm on Ubuntu 12.10 with LAMP setup. 我在使用LAMP设置的Ubuntu 12.10上。 I copied a subdirectory which has project files (php, html, css) from xampp/htdocs on my Windows PC into /var/www/ of my ubuntu. 我从Windows PC上的xampp / htdocs复制了一个包含项目文件(php,html,css)的子目录到ubuntu的/ var / www /中。 However, when I access those files from browser (I can see the directory listing), I get 403 Forbidden on all files within that directory. 但是,当我从浏览器访问这些文件时(可以看到目录列表),该目录中的所有文件都被禁止使用403。 So I create new dummy php files within that directory just to see if I can access, and it works. 因此,我在该目录中创建了新的虚拟php文件,以查看是否可以访问,并且它可以工作。 Any idea what might be the problem? 知道可能是什么问题吗?

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 尝试执行chmod -R 775 /var/www/folder和/或chown -R domain:www-data /var/www/folder其中domain是该特定虚拟主机或www-data的用户

for directory listing you may want to modify in /etc/apache2/sites-available/default 对于目录列表,您可能需要在/ etc / apache2 / sites-available / default中进行修改

+Indexes +索引

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

This is how I solved the issue: 这是我解决问题的方法:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM