Re: [PHP] MkDir Help

2008-10-23 Thread Yeti
If you are prior PHP5 write your own recursive mkdir function [1] as
posted on this list a while ago.

[1] http://marc.info/?l=php-generalm=121926660406116w=2

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



[PHP] MkDir Help

2008-10-22 Thread Jason Todd Slack-Moehrle

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

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



Re: [PHP] MkDir Help

2008-10-22 Thread Stut

On 23 Oct 2008, at 00:33, Jason Todd Slack-Moehrle wrote:
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?


Permissions. Does the web user have write access to wwwroot? Without  
it that function call will fail.


Also I don't think you're really running 5.2.5 since the recursive  
(3rd) parameter was added in 5.0. AFAIK the only way it would think  
mkdir takes no more than 2 parameters is if you're using an older  
version.


-Stut

--
http://stut.net/

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



Re: [PHP] MkDir Help

2008-10-22 Thread Ashley Sheridan
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



Re: [PHP] MkDir Help

2008-10-22 Thread Jason Todd Slack-Moehrle

Hi,


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!


I will check all of this out and see what is going on.

Thanks!

-Jason


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



Re: [PHP] MkDir Help

2008-10-22 Thread Jim Lucas

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



Along with what everybody else said.  echo out $dirToCreate and see if 
it is exactly what you expect it to be.  ../people/jason  Also, make 
sure that that directory doesn't already exist.


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