ID:               37946
 User updated by:  oscar dot de dot lathouder at gmail dot com
 Reported By:      oscar dot de dot lathouder at gmail dot com
 Status:           Bogus
 Bug Type:         Directory function related
 Operating System: Fedora Core 5
 PHP Version:      5.1.4
 New Comment:

why does mkdir() create the first dir (1), failes to make the others,
when recursive=true?


Previous Comments:
------------------------------------------------------------------------

[2006-06-28 11:42:32] [EMAIL PROTECTED]

mkdir() has nothing to do with the permissions, it just creates
directories.
Not PHP problem.

------------------------------------------------------------------------

[2006-06-28 11:32:36] oscar dot de dot lathouder at gmail dot com

Description:
------------
The recursive option of mkdir() creates wrong owners for created
parents.







Reproduce code:
---------------
Executed file:
-rw-rw-rw- 1 thisuser mygoup  5900 Jun 28 09:32 test.php

saveLocation:
/mnt/shared/

ls -al /mnt/shared/
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 .
drwxr-xr-x 5 root     root     4096 Jun 23 15:11 ..
(note: server is MS Windows 2000 server, executing server is Fedora
Core 5. 'thisuser' has read/write permissions on server as well)

Code:
$saveLocation = /mnt/shared/1/2/3/
if (!file_exists($saveLocation) && !is_dir($saveLocation))
mkdir($saveLocation,0777,true);



Expected result:
----------------
ls -al /mnt/shared/
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 .
drwxr-xr-x 5 root     root     4096 Jun 23 15:11 ..
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 1

ls -al /mnt/shared/1/
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 .
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 ..
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 2

ls -al /mnt/shared/1/2/
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 .
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 ..
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 3


Actual result:
--------------
ls -al /mnt/shared/
drwxrwxrwx 1 thisuser  mygroup    0 Jun 28  2006 .
drwxr-xr-x 5 root         root 4096 Jun 23 15:11 ..
drwxrwxrwx 1 root         root    0 Jun 28  2006 1

ls -al /mnt/shared/1/
drwxrwxrwx 1 root         root    0 Jun 28  2006 .
drwxrwxrwx 1 thisuser  mygroup    0 Jun 28  2006 ..

Errorlog:
[Wed Jun 28 10:58:43 2006] [error] [client xx.xx.xx.xx] PHP Warning: 
mkdir() [<a href='function.mkdir'>function.mkdir</a>]: Permission
denied in /var/www/html/test.php on line 2, referer:
http://xx.xx.xx.xx/test.php

When I execute the same script again, it will create another directory
(2), but exits with the same error.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37946&edit=1
  • #37946 [Bgs]: mkdir recursive ... oscar dot de dot lathouder at gmail dot com

Reply via email to