mkdir not working in PHP

Abhinav picture Abhinav · Feb 7, 2010 · Viewed 10.2k times · Source

Have been pulling out my hair for the past 2 hours on this and am sure I am doing something really stupid.

<?php
mkdir("blah", 0777);
?>

This works through the command line and the folder gets created. But the same thing doesn't work when I try to run it through the browser. Any file permission issues?

Answer

Tyler Carter picture Tyler Carter · Feb 7, 2010

Could it possibly be that while running under the command line, the script inherits your permissions, but when running from the browser it doesn't?

In that case you would want to make your directory permissions 'write' for group.