Reputation: 2673
I use file_put_contents()
all the time, but this time it is failing.
It returns non-FALSE, which is should indicate the number of bytes written, but no file is actually generated.
(and it says 20 bytes were written for a 7-character string)
$ php --interactive
php > print realpath("/etc/php.d");
/etc/php.d
php > $n = file_put_contents("yo baby", "/etc/php.d/dvmon.ini");
php > print $n;
20
php > exit
$ ls -l /etc/php.d/d*
ls: cannot access /etc/php.d/d*: No such file or directory
The permissions are wide open:
$ ls -ld /etc
drwxrwxrwx. 128 root root 12288 Feb 9 05:19 /etc
$ ls -ld /etc/php.d
drwxrwxrwx 2 root root 4096 Feb 9 05:46 /etc/php.d
Upvotes: 0
Views: 166
Reputation: 18825
The order of parameters is the opposite. First file comes, then the content:
$n = file_put_contents("/etc/php.d/dvmon.ini", "yo baby");
Upvotes: 2