PHP Writing and Permissions Problems.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Freddie Bingham
    Former vBulletin Developer
    • May 2000
    • 14057
    • 1.1.x

    PHP Writing and Permissions Problems.

    I am exploring using 'Mogrify' to resize user submitted icons submitted through my avatar hack. The problem is that while uploading a files through PHP doesn't seem to be a problem as they are stored in /tmp, /var/tmp or whatever eles may be set, copying these files to the users directory does present a problem.

    PHP generally runs as user "nobody" or "web" and that user doesn't have permission to write to the users directory. I have searched and found this to be a common problem. The solutions I have found is to set the directory for the images to mode 777, which is not a good solution at all, or change the ownership of the directory to the same as the user for which PHP is running as. I have tried to do that with out any luck.

    Example

    My test images destination directory is called "php" so I attempted to change it to be owned by "web" so that PHP could write to it but not have to make it world writeable so that anyone can screw with it.

    Code:
    bash-2.03$ chown web:web php
    chown: php: Not owner
    bash-2.03$
    But I am clearly the owner of the directory :

    Code:
    drwxr-xr-x   2 hedge    users        512 Aug  3 12:48 php
    What gives here? Am I not allowed to do this? If I can get this to work than I will modify the avatar hack to also give the option of storing the images in the filesystem instead of the database. And use mogrify to resize them all to a consistent size for appearence sake.

    And if that all goes well then I start my Picture Gallery hack which definately needs to be able to write as it needs to create thumbnails and optimize pictures.

    P.S. if PHP is run as a CGI, what is the situation with permissions?
  • Bealers
    New Member
    • Jun 2000
    • 25

    #2
    KLUDGE alert!

    upload to a PHP writeable dir then cron a script as root to chown/move the files to the right place. You could have the users name and home dir in some temp database table, and clear this out after the cron job

    shoddy but it'd work.......

    Comment

    • bsumpter
      New Member
      • Aug 2000
      • 3

      #3
      Do you have root on this box ????

      ?????

      Comment

      • Freddie Bingham
        Former vBulletin Developer
        • May 2000
        • 14057
        • 1.1.x

        #4
        No and every solution I have read says to just make a directory with permissions 777 to solve the problem.

        I looked at your site and see you have mp3 and photo galleries. Can I see your uploading script?

        [Edited by rangersfan on 08-27-2000 at 01:36 AM]

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...