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.

PHP copy() problem, the new file's owner is "nobody"?

Discussion in 'General Discussion' started by markking, Aug 2, 2008.

  1. markking

    markking Registered

    Joined:
    Aug 2, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hey guys,
    Currently I am working on a PHP script that will copy a file

    copy (sourceFile, destFile);

    But after making the copy, the destFile has owner of "nobody" while the sourceFile still has the correct owner of "myUsername".

    At first I thought it was doing this because suPHP was not enabled, or just not working. I have gone back into CPanel WHM and checked that suPHP is enabled, and I also see suPHP is running via

    root@server # /usr/local/cpanel/bin/rebuild_phpc

    which says I am using suPHP

    Can anyone lead me into the right direction to get the owner to be the same as making the copy?

    Any help would be grateful.

    Thanks!
     
  2. Stefaans

    Stefaans Well-Known Member

    Joined:
    Mar 5, 2002
    Messages:
    451
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Vancouver, Canada
    This does indeed seem like SuPHP is not active. If it was, the owner of the copied file would have been the account user, not nobody.

    I suggest you have a look (in WHM) at Configure PHP and SuExec and check that SuPHP is indeed selected as the handler for the particular version of PHP.

    You can also have a look at the log at /usr/local/apache/logs/suphp_log to verify that SuPHP is indeed being called for this account.
     
  3. markking

    markking Registered

    Joined:
    Aug 2, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Thank you for your help.

    I tried

    tail -f /usr/local/apache/logs/suphp_log

    result message
    -----------------------------------
    tail: cannot open `/usr/local/apache/logs/suphp_log' for reading: No such file or directory
    tail: no files remaining



    I looked under "Configure PHP and SuExec" and this is what I see

    Current Configuration

    Option Configured Value
    Default PHP Version (.php files) 5
    PHP 5 Handler dso
    PHP 4 Handler none

    Apache suEXEC on



    Also, when I run the PHP scripts I see they are being ran as "nobody" I get this information from running "top"


    Can you please tell me what I might need to do to get it to work correctly? Thank you!!
     
  4. Stefaans

    Stefaans Well-Known Member

    Joined:
    Mar 5, 2002
    Messages:
    451
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Vancouver, Canada
    The dso setting confirms that you are not using SuPHP. That fact that the suphp_log file does not exist either, reinforces this.

    Check if you have the option to set the handler to suphp. If not, you need to rebuild Apache with SuPHP support.

    I hope this helps ;)
     
  5. markking

    markking Registered

    Joined:
    Aug 2, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    I set the handler to suPHP and everything is working great. Thanks for the help
    Stefaans!
     
Loading...

Share This Page