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.

Unable to CHOWN via PHP

Discussion in 'General Discussion' started by donnie, Sep 15, 2003.

  1. donnie

    donnie Active Member

    Joined:
    May 23, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    uk
    Hello Everybody,
    I am having a problem on Linux redhat 7.3. Safe Mode on and phpsuexec disabled.

    I want to create a folder and copy a file from some other folder in it. But the problem is as soon as I create a folder from PHP file using mkdir() and copy a file in it, it assigns it nobody as user and nobody as a group. I want that the user and group of both the newly created directory and file should be the same as the script from which it's created.

    I have also tried chown and shell_exec both the commands in PHP but both haven't worked.

    Please help me how can I set the user and group of newly created folder & copied file.

    cPanel.net Support Ticket Number:
     
  2. WebmastTroy

    WebmastTroy Well-Known Member

    Joined:
    Apr 28, 2002
    Messages:
    85
    Likes Received:
    0
    Trophy Points:
    6
    Don't you have to have phpsuexec enabled to get it away from 'nobody'? Having phpsuexec enabled will make the script run under your username.

    I've never actually programmed in PHP so I could be wrong.

    cPanel.net Support Ticket Number:
     
  3. Stefaans

    Stefaans Well-Known Member

    Joined:
    Mar 5, 2002
    Messages:
    451
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Vancouver, Canada
    You are 100% correct WebmastTroy. We choose to run phpsuexec for added security and to "fix" the behaviour around ownership.

    cPanel.net Support Ticket Number:
     
  4. lvalics

    lvalics Active Member

    Joined:
    Sep 30, 2003
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    Anyone get a solve to this problem.
    We are stucked since a week i this to chmod a directory or a file in PHP.
    We used fopen, chmod any solution what we find it and seems that the only solution is to get FTP connection and work with that.
    Anyone know a PHP source what is working with suexec and can upload images in directory ?

    cPanel.net Support Ticket Number:
     
  5. Jemshi

    Jemshi Well-Known Member

    Joined:
    Sep 11, 2003
    Messages:
    210
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    have you enables suexec and still not working ?

    you have the shebang line

    #!/usr/local/bin/php

    as the first line of script ?

    cPanel.net Support Ticket Number:
     
Loading...

Share This Page