What I am trying to do is to create a folder from PHP code. Initially it may sound like a PHP question, but after sending lot of time online, I realize that the main issue is related to Apache permission. I tried almost everything that I could google but couldn't find a solution to my problem.
I installed the Apache server with apt-get and with the default installation web root was /var/www/html and my PHP script is there. With default installation I was not even able to write file in that folder as well. Later from google, I found that I have to make www-data the owner of the folder where I am trying to write file. I did so and the folder got created.
But my main goal is to create the folder under /root/work/temp but if I follow the same process and make www-data the owner of that folder like I did for /var/www/html, it do not work.
So what do I need to different in this case. FYI, I have also applied chmod to make both folder have enough read/write permission.
Thanks in advance.
Answer
Apache also needs to be be to traverse the path to /root/work/temp
so check the permissions for /root
and /root/work
, they both need to be at least executable by the user Apache runs as.
However the main question I would have is why on earth would you want to do this in the first place!
You may also need to allow this to happen in SELinux (or similar) if you are running them.
No comments:
Post a Comment