mkdir not working in PHP
Solution 1
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.
Solution 2
Your web server (apache?) is running as it's own user, and doesn't have permission to write to the directory you're running mkdir in.
Give your web server's user permission to write to the directory by either A) making it Owner, B) adding it to the Group if the Group has write permission, or C) give Everyone write permission (not recommended for most setups).
![Lauren](https://i.stack.imgur.com/DjWMR.jpg?s=256&g=1)
Lauren
I make things usually with code and some of them turn out to be useful. You can find me on Twitter at http://www.twitter.com/a85. Projects for developers and designers: Postman - https://www.getpostman.com Android-app-patterns - http://www.android-app-patterns.com
Updated on July 07, 2022Comments
-
Lauren almost 2 years
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?