I have a WEB-page on Apache/2.2.9 (Debian) server located in .../public_html
I am a user with no root preveligies. I rewrote my site in PHP and noticed that it cannot write files in ../public_html
I changed everything in the folder to 777
and the folder itself, but still when the PHP script is executed, nothing can be written by www-data
user. So I cannot even log visitors of my web-site into a file. Is there some way to write something exported by www-data user?
-
Talk to your admin. – Sven Jul 08 '16 at 10:22
1 Answers
The reason for this is probably to protect the server when people when do really stupid things like changing all the permissions to 777.
Being able to write data is a really essential capability for any application - the world wide web was originally designed a publishing medium but quickly became an application platform. There is no point in provisioning PHP on a webserver without the capability to persist data. So it seems highly improbable that the server is configured in such a way as to prevent you writing your data to a safe location. But that safe location is unlikely to be within ~/public_html. We don't know where that location is - your local systems admin / service provider should.
You should really take some time to learn about the security of PHP applications - there are lots of websites and a few good books on the topic.

- 21,009
- 1
- 31
- 52