Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 587
clouddreams Avatar asked Feb 21 '13 00:02

clouddreams


People also ask

How do I open a php file in a different directory?

To access the root begin your path with "/". If you want to go up one directory from where you are currently, e.g. from /x/a/ to /x/ you could use "../". If you want to go back up two directories (e.g. from /x/a/ to /) you could use "../../" (rather than ".../" which you mentioned).


2 Answers

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/

like image 85
Robert Mihai Ionas Avatar answered Sep 30 '22 05:09

Robert Mihai Ionas


This is how I solved the issue:

sudo su
chmod a+rwx /var/www/html/
like image 43
Praneeth Jayarathna Avatar answered Sep 30 '22 05:09

Praneeth Jayarathna