NYCPHP Meetup

NYPHP.org

[nycphp-talk] Why can't I create a second directory?

Gary Mort bz-gmort at beezifies.com
Thu Aug 30 08:22:35 EDT 2007


I have a complex little install script that creates directories and 
subdirectories and copies files.

It keeps failing on one providers server.

I boiled down the install script problems to the fact that it cannot 
create a subdirectory after creating a directory.

I made a simple test script, all it does is create one subdirectory, 
than create another inside the first.
I set the mode to 777 just to make sure the directory would be created 
completely unsecured(I will also note that does not happen, instead the 
directory is created as 755 which should STILL be acceptable since the 
script itself is the one creating both directories and thus should be 
the owner).

Any ideas on why the first case works and the second case does not?


$path = "/var/www/vhosts/mydomain.com/httpdocs/j/components/com_test/";
$mode = 0777;
                if (!@mkdir(substr($path,0,-1),$mode)) {
                    die ("Cannot create ".substr($path,0,-1));
                }
                
$path = "/var/www/vhosts/mydomain.com/httpdocs/j/components/com_test/test/";
$mode = 0777;
                if (!@mkdir(substr($path,0,-1),$mode)) {
                    die ("Cannot create ".substr($path,0,-1));
                }
                




More information about the talk mailing list