Article ID: 777, created on Oct 6, 2008, last review on Apr 18, 2012
There is a BUG in PHP, for example http://bugs.php.net/bug.php?id=28401 or http://bugs.php.net/bug.php?id=36630. If you change umask (or other process' environment variables such as Time Zone ) in any PHP script, it will not be returned back to the default value after the HTTP request is finished, but still be applied to the 'httpd' process which ran the script. So, the next time this 'httpd' process will serve any request with umask which was set by the previous script. This way new files are created with different permissions via PHP scripts.