Closed Thread
Results 1 to 9 of 9
Like Tree1Likes
  • 1 Post By descalzo

Thread: PHP mkdir(); Error

  1. #1
    cdh47315 is offline x10Hosting Member cdh47315 is an unknown quantity at this point
    Join Date
    Mar 2011
    Posts
    7

    Question PHP mkdir(); Error

    I'm making a test script for a web application I'm developing, and in the registration of that web app I have a small script in which it makes a few folders under the user's name.
    Here is my code:
    PHP Code:
            //If there is not error
            
    if(!$user->has_error()) {
                            
    $userdir "filesystem/".$username;
                            
                            
    //BEGIN USER FILESYSTEM CREATION
                            
    mkdir($userdir."/");
                            
    mkdir($userdir."/home/");
                            
    mkdir($userdir."/home/media/");
                            
    mkdir($userdir."/home/scripts/");
                            
    mkdir($userdir."/home/desktop/");
                            
    //END USER FILESYSTEM CREATION

                
    $user->error("Registration successful! You may now log in.");
                    }
        } 
    The line that prints the string "Registration... log in" works just as expected, and I can take out the mkdir() lines and the script will execute perfectly.
    With the mkdir() lines, I get this warning message:
    Warning: mkdir() [
    function.mkdir
    ]: File exists in /home/cdh473/public_html/<folder>/<folder>/register.php on line 22
    And the <folder> directories do have different names...
    Anyone know why I'm getting this?
    I looked around and saw that x10hosting doesn't use Safe Mode, so that shouldn't be the problem.

    EDIT:Also, it should be noted that under the folder "filesystem" it creates a directory called "home" and has all the subdirectories under it that it should, but "home" should be created under the user's own personal folder!
    Last edited by cdh47315; 08-07-2011 at 09:29 PM.

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,635

    Re: PHP mkdir(); Error

    Which is line 22 ?
    Nothing is always absolutely so.

  3. #3
    cdh47315 is offline x10Hosting Member cdh47315 is an unknown quantity at this point
    Join Date
    Mar 2011
    Posts
    7

    Re: PHP mkdir(); Error

    Quote Originally Posted by descalzo View Post
    Which is line 22 ?
    the first mkdir() line.
    also that's the only directory that doesn't get created.

  4. #4
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,635

    Re: PHP mkdir(); Error

    Huh? That doesn't make sense.
    Nothing is always absolutely so.

  5. #5
    cdh47315 is offline x10Hosting Member cdh47315 is an unknown quantity at this point
    Join Date
    Mar 2011
    Posts
    7

    Re: PHP mkdir(); Error

    Quote Originally Posted by descalzo View Post
    Huh? That doesn't make sense.
    PHP Code:
    mkdir($userdir."/"); 
    that'd be line 22.

  6. #6
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,635

    Re: PHP mkdir(); Error

    Let's say $username is "descalzo"

    You said "filesystem/descalzo" was not created. But "filesystem/descalzo/home" etc were.
    Nothing is always absolutely so.

  7. #7
    cdh47315 is offline x10Hosting Member cdh47315 is an unknown quantity at this point
    Join Date
    Mar 2011
    Posts
    7

    Re: PHP mkdir(); Error

    Quote Originally Posted by descalzo View Post
    Let's say $username is "descalzo"

    You said "filesystem/descalzo" was not created. But "filesystem/descalzo/home" etc were.
    I'll use your example.

    $username is "descalzo"
    "filesystem/descalzo" is NOT created.
    "filesystem/descalzo/home" is NOT created.
    "filesystem/home" IS created.

    I have no idea why it is happening this way.

  8. #8
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,635

    Re: PHP mkdir(); Error

    Put:

    echo "username is: " . $username . " in the script." ;

    in your script just before the mkdir.

    What it is telling you is that $username is empty.
    Last edited by descalzo; 08-07-2011 at 09:52 PM.
    cdh47315 likes this.
    Nothing is always absolutely so.

  9. #9
    cdh47315 is offline x10Hosting Member cdh47315 is an unknown quantity at this point
    Join Date
    Mar 2011
    Posts
    7

    Re: PHP mkdir(); Error

    Quote Originally Posted by descalzo View Post
    Put:

    echo "username is: " . $username . " in the script." ;

    in your script just before the mkdir.

    What it is telling you is that $username is empty.
    I've been trying to figure out the solution all day! How did I not think of this?

    EDIT: After a bit of tweaking, I got my script to work. The staff here are fantastic.
    Last edited by cdh47315; 08-07-2011 at 10:07 PM.

Closed Thread

Similar Threads

  1. Mkdir
    By botsmartpanel44 in forum Free Hosting
    Replies: 0
    Last Post: 07-27-2011, 01:38 PM
  2. Replies: 1
    Last Post: 08-20-2010, 03:26 AM
  3. mkdir() and File functions
    By expose in forum Free Hosting
    Replies: 1
    Last Post: 04-04-2008, 08:43 AM
  4. Replies: 1
    Last Post: 03-03-2008, 10:58 AM
  5. 403 error after using mkdir()
    By ViperBlade in forum Free Hosting
    Replies: 0
    Last Post: 11-15-2007, 10:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers