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 running as user ?

Discussion in 'General Discussion' started by EMS, Oct 13, 2003.

  1. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    Hi, I have a user with a PHP permission problem. His script basically creates an entry in a MySQL database for an image, then uploads the chosen image from the users PC.

    During this process the image is moved from /TMP to an image folder and it is at this time the problem is occuring..

    This folder is chmod 711 so the script can write to it but it cant be viewed in a browser.

    Looking at files in the users home - all are owned by the user - even ones that have been uploaded.

    I thought PHP scipts should run as "nobody".

    The problem has only recently happened, no changes were made to the script. It seems to be after a cpanel update.

    I have run easyapache but the problem still remains.

    here is the error...

    Warning: move_uploaded_file(../images/33IMG_0472.JPG): failed to open stream: Permission denied in /public_html/maintenance/edited.php on line 44

    Warning: move_uploaded_file(): Unable to move '/tmp/php2ZBXjm' to '../images/33IMG_0472.JPG' in /public_html/maintenance/edited.php on line 44
    Problem: Could not move file to destination directory

    This is the code...

    42 $upfile = '../images/'.$random.$picturename;
    43 if(is_uploaded_file($picture)){
    44 if(!move_uploaded_file($picture, $upfile)){
    45 echo "Problem: Could not move file to 46 destination directory";
    47 exit;


    Any ideas ?

    cPanel.net Support Ticket Number:
     
  2. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    If you're using phpsuexec the scripts will run as the user, not nobody.

    cPanel.net Support Ticket Number:
     
  3. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    not using phpsuexec.

    cPanel.net Support Ticket Number:
     
  4. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    If I CHMOD the images dir to 777 this allows the file upload to take place.

    This was not a problem before when using 711.

    I'm still learning this stuff. Can anyone shed some light on what may cause this ?

    The only changes to this server are from regular cpanelwhm auto updates - (currently on bleeding edge). I run easyapache whenever neccessary.

    Why would the permissions change like this for no apparent reason ?


    cPanel.net Support Ticket Number:
     
    #4 EMS, Oct 14, 2003
    Last edited: Oct 14, 2003
  5. jeroman8

    jeroman8 Well-Known Member

    Joined:
    Mar 14, 2003
    Messages:
    410
    Likes Received:
    0
    Trophy Points:
    16
    Hi,

    just had a client complaining about same error.
    He had 755 on the folder he should upload pix to
    and it didn't work. I chmod it to 777 and it worked fine.

    Never thought about it more, used to that it must
    be 777 when writing stuff to a folder.
    especially if you're cgi scripts.
     
Loading...

Share This Page