|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42653 mkdir ("foo/bar/") not working
Submitted: 2007-09-13 09:33 UTC Modified: 2007-10-19 01:00 UTC
Avg. Score:4.5 ± 0.9
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:1 (25.0%)
From: xavier at sdv dot fr Assigned:
Status: No Feedback Package: Directory function related
PHP Version: 5.2.4 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: xavier at sdv dot fr
New email:
PHP Version: OS:


 [2007-09-13 09:33 UTC] xavier at sdv dot fr
With php 5.2.4 if $pathname has a trailing /, mkdir($pathname) don't work. This is a new behavior, it was working in php 5.2.3

Reproduce code:
echo mkdir ("toto/")

Expected result:

Actual result:
Warning: mkdir() [function.mkdir]: Unable to access toto/ in /www/root/default_vhost/a/index.php on line 2


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-13 09:41 UTC]
Works fine for me. Please give some more information, f.e. what SAPI you're using.
 [2007-09-13 13:00 UTC] xavier at sdv dot fr
The bug is occuring with mod_php against apache 1.3.37
I have the same problem with the CLI version

You can consult our phpinfo() : and our php.ini
 [2007-09-13 15:14 UTC]
Do you have open_basedir and/or safe_mode enabled?
 [2007-09-13 17:10 UTC] xavier at sdv dot fr
Open basedir and safe mode are in effect, as you can see in the phpinfo

But they are not relevent. The mkdir fails within the allowed path, with corrects uid/gid.
If it was an open_basedir or safe_mode problem, mkdir("foo") whould fail like mkdir("foo/"). But this is not the case. mkdir("foo") works, mkdir("foo/") doesn't.

I even try the code with de CLI and a void php.ini, I have the same error.

With exactly the same configuration and PHP 5.2.3, both mkdir("foo") and mkdir("foo/") are working
 [2007-09-19 10:31 UTC]
Exactly what OS is this? (linux kernel version, distro, etc..)
 [2007-10-01 12:27 UTC] xavier at sdv dot fr
Sorry for the delay, I was on holydays

OS : fedora core 2, kernel 2.6.10 SMP
 [2007-10-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 05:01:34 2024 UTC