The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Warning: mkdir(): Permission denied

Discussion in 'General Discussion' started by ryan-fah, Nov 14, 2007.

  1. ryan-fah

    ryan-fah Member

    Joined:
    Dec 20, 2006
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I have recently updated PHP using easyapache and since the update, any PHP scripts that use mkdir(), chmod() or rmdir() fail.

    Warning: mkdir(): Permission denied in /home/user/path/to/file.php on line 167
    Warning: chmod(): No such file or directory in /home/user/path/to/file.php on line 167


    On PHP.net I found a link to a test script that creates folders, changes between them and then deletes them. When it has finished it reports it on screen.

    http://goanna.cs.rmit.edu.au/~geoffwa/relative_path_bug.php

    When I run the test I got:

    Current working directory is: /home/fahd/public_html mkdir ./a failed


    The folder permissions are correct and as far as I am aware were not changed during the update. The files and folders have the right ownership and I have run chown -R user:nobody /home/user to make sure.

    I almost forgot to say that Safe Mode for PHP is turned off.

    Basically what I am asking is, is there a seperate module in PHP that is needed for mkdir, chmod and rmdir commands to work in PHP scripts? Or are there any lib files that I may be missing?

    Thanks,

    Ryan
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    IIRC, the permissions should be user:user not user:nobody. Also, are you running PHP under SuPHP or not?

    If you are running PHP under SuPHP, ensure the directory permissions are 700 and not 777. SuPHP pretty much hates anything above 755 because it's rather insecure and isn't needed at all in a SuPHP environment as the PHP script runs as the user, not user nobody.

    If you are not running SuPHP (or phpSuExec if you're on STABLE), then PHP is running as user nobody and the directory permissions will need to be 777 so user nobody can modify the contents of the directly (namely by creating a new directory).
     
  3. ryan-fah

    ryan-fah Member

    Joined:
    Dec 20, 2006
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    I am not running PHP under SuPHP and I am sure I have PHP running as nobody.

    The version of PHP I am running is 5.2.1 and was previously using version 5.2.0.

    I have tried to set the directory permissions to 777 from 755 and the script still didn't work.


    Also when I use user:user I get the following message on the site.

    Forbidden
    You don't have permission to access / on this server.
    Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
     
Loading...

Share This Page