0

My php project reported error: unable to write file. I found that might be caused by permission guaranteed for directory containing my project files.

I did this:

sudo chown [username]:[username] -R [directory location]

and then restarted apache but nothing got changed even my /WWW is in home. Any help is appreciated :)

  • 1
    Your project is expecting your files to have a name. Question: is that name the same as your username? If not you need to change your files to -that- name and not your username. And follow muru's link :) – Rinzwind Dec 15 '15 at 10:09
  • Anyway, you should not change owner of vhost root directory to your user. It's normally of www-data. – Tung Tran Dec 15 '15 at 10:13
  • @TungTran always show changing permission not permitted –  Dec 15 '15 at 11:37
  • OK I've left an answer. See if it fixes your issue. – Tung Tran Dec 15 '15 at 12:48

2 Answers2

1

I found that solution got fixed but only working for default /var/www directory: How to avoid using sudo when working in /var/www?

1
sudo chown -R www-data:www-data /home/$USER/www
sudo chmod -R 775 /home/$USER/www

Then add your user account to www-data group

sudo adduser $USER www-data
Tung Tran
  • 3,945