How to Find out the current USER/GROUP of the php script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • henryrhenryr
    New Member
    • Jun 2007
    • 103

    How to Find out the current USER/GROUP of the php script

    Hi

    I am trying to debug an upload script and I need to know what the user/group is of the php-script that's running.

    My problem is that the webserver settings have '48' as the user/group - presumably 48 means httpd. But when I upload files through PHP, they are moved from the temp folder and the permissions are 744 with the owner as '48'. This means I can't change the file in FTP/SSH.

    I am trying to make a script to chmod() the files but the script doesn't do anything and I think it is because the script uses my username, not httpd, but I want to check.

    If you have a solution for the bigger problem, amazing. Otherwise, the intermediary one - knowing the PHP script's user/group would be great.

    Thanks!

    Henry
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    If you're using httpd (apache) then PHP has nothing to do with User/Group. It's apache that's configured to use a specific user/group.

    What's the bigger problem? Why can't you access a file using FTP? if the default permissions are 744. This means it can be read by anybody (any user on the server).

    Dan

    Comment

    • henryrhenryr
      New Member
      • Jun 2007
      • 103

      #3
      Hi Dan

      Thanks for the reply. I've been away for a while.

      My guess is that when the file is uploaded it goes into the temp folder and is owned by '48' - the httpd user. When the PHP script then transfers it to the relevant folder in the web-root, it the owner is not changed.

      I have attempted to 'chown' using a PHP script but that doesn't work - this is why I want to determine the current user/group of the running script - just to see if it is 48 and the problem must be solved in another way. I can't work out why my script to 'chown' won't work but the upload script is able to upload as user '48'.

      I need the permissions to be r/w/x so I can delete the files if necessary. Yes, it doesn't cause immediate problems to the application as it is readable like you say.

      Comment

      Working...