PHP mkdir 0777 fail chmod 0777 works
问题 using PHP 5.2.14, this is what happens [user@VE213 public_html]$ php -r "mkdir('directory', 0777);" [user@VE213 public_html]$ ls -lt drwxrwxr-x 2 rankranger rankranger 4096 Dec 8 17:28 directory [user@VE213 public_html]$ php -r "chmod('directory', 0777);" [user@VE213 public_html]$ ls -lt drwxrwxrwx 2 rankranger rankranger 4096 Dec 8 17:28 directory Did not find any related bugs in the php bug list, any idea? 回答1: $old = umask(0); mkdir($dir,0777); umask($old); Read this, http://php.net/manual