BEWARE, a couple of the examples in the comments suggest doing something like this:chmod(file_or_dir_name, intval($mode, 8));However, if $mode is an integer then intval( ) won't modify it. So, this code...$mode = 644;chmod('/tmp/test', intval($mode, 8));...produces permissions that look like this:1--w----r-TInstead, use octdec( ), like this:chmod(file_or_dir_name, octdec($mode));See also: http://www.php.net/manual/en/function.octdec.php