Find the answer to your Linux question:
Results 1 to 7 of 7
Hi I am new to the admin on the linux apache VPS. php is running OK except that I cannot get the basic php mkdir() command to work. I think ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Location
    Plymouth UK
    Posts
    5

    [SOLVED] mkdir() problem on linux apache VPS


    Hi
    I am new to the admin on the linux apache VPS. php is running OK except that I cannot get the basic php mkdir() command to work. I think there is a directory permission problem? From the shell command level I have tried chmod 777 directoryname, and also

    chown -R apache:apache directoryname

    but still it won't create a directory (but mkdir() works on a shared host I am running). Any ideas?

    Grilly

  2. #2
    Linux Newbie
    Join Date
    Nov 2007
    Location
    Planet Earth
    Posts
    152
    You're right with permissions of your directory. Unless there is a problem with your code, probably your PHP installation has security options enabled (restricted functions, safe mode, or something similar)... check your php_info() to find that configurations.
    EOF

  3. #3
    Just Joined!
    Join Date
    Jun 2009
    Location
    Plymouth UK
    Posts
    5

    mkdir() on linux apache server

    Thanks Hugortega

    php code is simple and OK - it works on a shared host.

    Using vhost.conf I have set the php v5.2.9 to safe_mode 0 (off) and open_basedir none. This is shown by php_info().

    Grilly

  4. #4
    Linux Newbie
    Join Date
    Nov 2007
    Location
    Planet Earth
    Posts
    152
    Also, there is a bug with some version (I think 5.2) of PHP that have problems with trailing slashes on paths... I mean, mkdir("foo/path/") will not work, but mkdir("foo/path") will do the job.
    EOF

  5. #5
    Just Joined!
    Join Date
    Jun 2009
    Location
    Plymouth UK
    Posts
    5

    Smile mkdir() on linux apache server

    Thanks

    Yes - I found that / is important before the dir name eg /temp. It didn't work without it. Also, I needed the $_SERVER[] command. The php command that worked in the end was

    mkdir($_SERVER['DOCUMENT_ROOT']."/temp/newdir");

    after I had done

    chown -R apache:apache temp

    THis created newdir. Thanks for your help

    Graham

  6. #6
    Linux Newbie
    Join Date
    Apr 2008
    Location
    India
    Posts
    170
    tmp has noexec ...check that
    Regards
    David Anand
    -->Success is the list of failures ...!!!

  7. #7
    Just Joined!
    Join Date
    Jun 2009
    Location
    Plymouth UK
    Posts
    5

    mkdir() problem on linux apache VPS

    Thanks david

    Now have it going. Needed to use mkdir($_SERVER['DOCUMENT_ROOT']."/temp ...

    Graham

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •