2
Test fileperms() & chmod() functions: basic functionality
5
if (substr(PHP_OS, 0, 3) == 'WIN') {
6
die('skip Not on Windows');
8
// Skip if being run by root
9
$filename = dirname(__FILE__)."/006_root_check.tmp";
10
$fp = fopen($filename, 'w');
12
if(fileowner($filename) == 0) {
14
die('skip cannot be run as root');
23
Prototype: int fileperms ( string $filename );
24
Description: Returns the permissions on the file, or FALSE in case of an error
26
Prototype: bool chmod ( string $filename, int $mode );
27
Description: Attempts to change the mode of the file specified by
28
filename to that given in mode
30
$path = dirname(__FILE__);
32
echo "*** Testing fileperms(), chmod() with files and dirs ***\n";
33
fopen($path."/perm.tmp", "w");
34
var_dump( chmod($path."/perm.tmp", 0755 ) );
35
printf("%o", fileperms($path."/perm.tmp") );
40
var_dump( chmod( $path."/perm", 0777 ) );
41
printf("%o", fileperms($path."/perm") );
49
unlink(dirname(__FILE__)."/perm.tmp");
50
rmdir(dirname(__FILE__)."/perm");
53
*** Testing fileperms(), chmod() with files and dirs ***