note 99810 added to function.mkdir
| From: | satis at clankiller dot com | Date: | Wed, 08 Sep 2010 13:05:52 +0000 |
| Subject: | note 99810 added to function.mkdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172377@lists.php.net to get a copy of this message | ||
Please note that in a shared environment I failed to take into account an existing umask when I did
a mkdir(dirname, 0755). This ended up creating the directory (function returned true), but I
didn't have rights to do anything inside the folder, nor could I even view that it existed via
ftp.
However, file_exists(dirname) returned true. Eventually I figured out what happened and was able to
rmdir(dirname), then created the directory correctly.
So, when writing scripts you expect to be portable, either use umask to set your umask accordingly,
or do a straight mkdir(dirname) followed by chmod(dirname, 0755) (or whatever it is you're
looking for). If you make the same mistake I did, you should be able to rmdir() or chmod() the
folder so it's accessible.
----
Server IP: 192.41.42.26
Probable Submitter: 63.98.25.109
----
Manual Page -- http://www.php.net/manual/en/function.mkdir.php
Edit -- https://master.php.net/note/edit/99810
Del: integrated -- https://master.php.net/note/delete/99810/integrated
Del: useless -- https://master.php.net/note/delete/99810/useless
Del: bad code -- https://master.php.net/note/delete/99810/bad+code
Del: spam -- https://master.php.net/note/delete/99810/spam
Del: non-english -- https://master.php.net/note/delete/99810/non-english
Del: in docs -- https://master.php.net/note/delete/99810/in+docs
Del: other reasons-- https://master.php.net/note/delete/99810
Reject -- https://master.php.net/note/reject/99810
Search -- https://master.php.net/manage/user-notes.php