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

clouddreams picture clouddreams · Feb 21, 2013 · Viewed 33.7k times · Source

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?

Answer

Robert Mihai Ionas picture Robert Mihai Ionas · Feb 21, 2013

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/