Re: MkDir Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2008-10-22 at 16:33 -0700, Jason Todd Slack-Moehrle wrote:
> Hi All,
> 
> I want to make a directory on my web server programatically when my  
> code to create a new user runs.
> 
> I am running PHP 5.2.5 on Linux.
> 
> I am running:
> 
> $dirToCreate = "..".$_SESSION['s_USER_URL'];
> mkdir($dirToCreate, 0777, TRUE); // create the directory for the user
> 
> $dirToCreate is: ../people/jason as an example
> 
> When I create this I am in <wwwroot>/admin and I want to create  
> <wwwroot>/people/jason
> 
> <wwwroot>/people already exists.
> 
> I get an error:
> 
> Warning: mkdir() expects at most 2 parameters, 3 given in
> /home/net1003/public_html/admin/_createPage.inc on line 5
> 
> Even without TRUE< this operation does not work.
> 
> Does anyone have any thoughts?
> 
> -Jason
> 
Well, as your mkdir is saying you can only have 2 parameters, I'm
guessing you're not yet running PHP 5. Also, as 0777 is the default
mode, you can omit this from your code to leave only one argument.

You didn't say the exact error you're getting when you omit the third
argument. My guess is it's a permission denied error, which is the most
common pitfall for file functions. Does Apache have access to your
wwwroot directory? Either make Apache the owner of the directory, add
the Apache group (the name varies from OS to OS, usually wwwrun, or www)
to the directory and allow group write permissions. You could chmod 777
the directory, but this isn't very safe at all, and I doubt you'll find
anyone on this list who'd recommend it!

Hope this helps.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux