Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    3

    Default PHP Upload file permission problems

    Guys/Gals

    Im using a PHP upload script that was previously working flawlessly. Recently for some reason unknown to me, when i do a php file upload it assignes the file permissions: 600 and owner gets set to 99. Im not sure what eh owner was set to previously when it was working before the change, however i do know that permissions were set to: 644 by default when it was uploaded.

    The real problem is that I cant even download the file via ftp.

    So my question is: Is there an apache setting that was updated or changed that is causing this and can it be changed in a secure way? This has become a headache for me and i would like to get it resolved... Any ideas?


  2. #2
    cPanel Staff cPanelJamyn's Avatar
    Join Date
    Jan 2009
    Posts
    59

    Default

    Hi,

    Without seeing the script in question, it's difficult to give you an accurate answer. However, it sounds like you are using suPHP for apache (good) but your script is acting as though you are still using DSO mode (bad). UID 99 is typically the 'nobody' user, which matches this theory.

    Is there a config file for your upload script that allows you to specify how it behaves in regards to ownership, and/or and what the perms should be for uploads? I'd also check to see if there is a newer version of whatever you're using that accounts for suPHP installs.

  3. #3
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Default

    Cpaneljamyn hit it right on target ....

    Your server is running PHP as a DSO (mod_php) which is very bad for many reasons including security, resource waste, and as you have now seen ownership conflicts.

    Any file uploaded by script under DSO will be given the owner "nobody" which is fine until you realize you have to access the file with some other account other than the generic Apache "nobody" user which might be you trying to edit the file or even the nightly backup process which will often skip those files and omit them from backup for the same reason.

    I strongly do not recommend using DSO based PHP on any server ....

    There is two strong alternatives that I would look to as to the type of PHP you should be using depending on your situation. On is SuPHP and the other is FCGI and there is certain advantages and strengths to each so which you go with really depends on your own situation but I would definitely look to getting one of those for your PHP platform.

    If you are on a shared hosting account and don't have access to change the PHP on your server then my advice is change hosts quickly.

    Regarding your immediate problem, you will need to change the permissions on the files to something other than 600 such as 644 or even 666 if necessary and then you should be able to fully access those files with your own login. If you are wondering how you can do that, you should be able to change the permissions from another PHP script because it will also execute as user "nobody" while your server still remains DSO based.

    Bottom line though is get off of DSO and you won't have this problem anymore.

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    2

    Default The same problem, 666 does not help

    Hello.

    I have the same problem and I assigned 666 permission before to change file owner. Here is an example:

    exec("chmod 0777 /home/meglio/license.txt");
    exec("chown meglio /home/meglio/license.txt");

    license.txt now has all permissions, but owner is still "nobody".
    Any ideas?

    Thanks,
    Anton

    UPDATE

    My hosting provider support confirmed that we are not running suPHP and he proposed to reconfigure
    the server to run under suPHP.

    I currently have 2 big sites running on this server and I'm afraid if this switch will affect them somehow?
    The priority is to solve the problem by keeping everything working live on the server.
    Last edited by meglio; 05-04-2010 at 03:17 PM.

Similar Threads & Tags
Similar threads

  1. language file upload problems
    By nineofus in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 12-02-2005, 11:49 AM
  2. file upload size of php
    By gidechoi in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 04-27-2005, 06:28 AM
  3. File upload - permission problems
    By nsusa in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 04-16-2005, 06:42 PM
  4. File Permission Problems - for once and for all! - Urgent
    By circlec in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 02-18-2005, 03:22 AM
  5. File Manager Upload Problems
    By griz in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 09-03-2004, 11:05 AM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube