php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19757 odd mkdir vrs chmod fileperms
Submitted: 2002-10-04 14:31 UTC Modified: 2002-10-04 14:35 UTC
From: fandelem at hotmail dot com Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 4.2.0 OS: linux 2.4.9-7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
36 - 16 = ?
Subscribe to this entry?

 
 [2002-10-04 14:31 UTC] fandelem at hotmail dot com
This is reproducable, though very odd.

I have a script that does this:

mkdir("fandelem",0777);


which when I issue 'ls -la' produces:
drwxr-xr-x    2 apache   apache       4096 Oct  4 11:16 fandelem

However when I add:

chmod("fandelem",0777);

which when I issue 'ls -la' produces:
drwxrwxrwx    2 apache   apache       4096 Oct  4 11:19 fandelem

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

I don't really understand why -- and I guess I could just have the code do an extra chmod() but I found it quite odd that this happens.

-kyle

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-04 14:35 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The mkdir call is affected by umask. Since on most systems (unix) default umask is 022 when it is applied to mode 0777 you get 755 directory permission.
To avoid this problem, do a call umask(0), before creating a directory.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 15:01:28 2024 UTC