note 108658 added to function.fileperms
| From: | sergioneATgmail | Date: | Tue, 15 May 2012 13:25:31 +0000 |
| Subject: | note 108658 added to function.fileperms | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-187989@lists.php.net to get a copy of this message | ||
Regarding "MartinAngermeier at gmx dot net" note.
It's wrong, that way you set wrong file permisions because you pass the octal as string.
And "0777" != 0777.
Also 777 (decimal) != 0777..
So the correct one:
<?
$source_file = '/var/www/test_source/test.php';
$dest_file = '/var/www/test_dest/test.php';
$permsions = fileperms($source_file);
copy($source_file, $dest_file);
chmod($dest_file, $permsions); // pass the chmod in octal as returned by fileperms.
?>
----
Server IP: 69.147.83.197
Probable Submitter: 79.113.235.231
----
Manual Page -- http://www.php.net/manual/en/function.fileperms.php
Edit -- https://master.php.net/note/edit/108658
Del: integrated -- https://master.php.net/note/delete/108658/integrated
Del: useless -- https://master.php.net/note/delete/108658/useless
Del: bad code -- https://master.php.net/note/delete/108658/bad+code
Del: spam -- https://master.php.net/note/delete/108658/spam
Del: non-english -- https://master.php.net/note/delete/108658/non-english
Del: in docs -- https://master.php.net/note/delete/108658/in+docs
Del: other reasons-- https://master.php.net/note/delete/108658
Reject -- https://master.php.net/note/reject/108658
Search -- https://master.php.net/manage/user-notes.php