Cannot write to file, although is_writable returns true

Anyone have any ideas on this? I check the file with file_exists()and is_writable(), both of which return true. I set the directory and the file in 777only to be safe, but try fwrite () or file_put_contents () do not change the file

Here is the relevant code:

$filePath = dirname( __FILE__ ) . '/' . 'myfile.txt';
file_put_contents($filePath, "waffles are delicious");
+5
source share
2 answers

You have noted access rights to the file, but you can also familiarize yourself with its ownership.

, uid/gid . , zip tar.gz , CMS , , , FTP.

, chown , / . , , root/su.

chown -R username:groupname *

-R , .

+1

php, , .

0

All Articles