Problems with mkdir() on Apache Linux

Discussion in 'PHP' started by vaidikkp, Oct 28, 2010.

  1. #1
    Hi,

    I have some problems with using the mkdir() function on my LAMP stack.

    When I use it, the function does not work (i.e. it does not create any folder). It does not show any error message as well.

    Also, when I tried using the mkdir shell using the shell_exec() in PHP, it did not work. I thought it could be because of Permissions on the Apache directory folder and my project folder. I changed the permission of /var/www/html/PHP (my project folder) to 0777 and it still didn't work.

    Need help urgently!
     
    vaidikkp, Oct 28, 2010 IP
  2. netload

    netload Member

    Messages:
    105
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #2
    Execute before mkdir

    ini_set('display_errors', 'on');
    error_reporting(E_ALL);
    PHP:
     
    netload, Oct 28, 2010 IP
  3. vaidikkp

    vaidikkp Peon

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi netload,

    I did as you said and got the following error:

    Warning: mkdir(): Permission denied in /var/www/html/cut/index.php on line 39

    After this I changed the ownership and the group ownership of the /var/www/html/cut folder to apache. It still does not work. :(
     
    vaidikkp, Oct 28, 2010 IP
  4. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #4
    Have you tried chmod the folder to 777? Maybe your webserver doesn't use the user "apache", sometimes it can be "http".
     
    Kaizoku, Oct 29, 2010 IP
  5. vaidikkp

    vaidikkp Peon

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I tried chmod 777 and I also checked the user by executing the whoami command through the shell_exec(). It says its apache. Also, I changed the ownership and group ownership of the directory to apache. It still doesn't work. :(
     
    vaidikkp, Oct 29, 2010 IP