Answer the question
In order to leave comments, you need to log in
Why can't php modify a text file on the server?
Raised on raspberry server (Apache2 + php). There is a file at /var/www/html/1.txt and an index.php file that writes content to it, but nothing works until I put chmod 777 permission on the file. Why is that? Why doesn't it work with 644 permissions?
Answer the question
In order to leave comments, you need to log in
If you can't write something to a file with 644 permissions, it means that the user under which Apache is running is not the owner. But it's better not to set permissions to 777, but to make the user under which Apache runs the owner of the /var/www/html folder and all files / folders inside it and set permissions like 755
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question