note 108658 deleted from function.fileperms by danbrown
| From: | danbrown@php.net | Date: | Tue, 15 May 2012 15:25:17 +0000 |
| Subject: | note 108658 deleted from function.fileperms by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-187990@lists.php.net to get a copy of this message | ||
Note Submitter: sergione AT gmail
----
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.
?>