chmod help

Discussion in 'PHP' started by zuemie, Apr 1, 2009.

  1. #1
    Hi,

    if a script requires some files and folders to be chmoded 777, is there a way to make 755 act as if it were 777? or get a script to work with 755 if it is required to be 777? Is there a way to set this up on the server?
     
    zuemie, Apr 1, 2009 IP
  2. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It really depends on which user is creating the files, which user the web server is running as, and so on. Without more information it's not possible to give a valid answer to your question.
     
    SmallPotatoes, Apr 1, 2009 IP
  3. zuemie

    zuemie Peon

    Messages:
    85
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Well i would be the only user. It's a dedicated server so i have root access.
     
    zuemie, Apr 1, 2009 IP
  4. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If all the files are being created by Apache, and also accessed by PHP running as an Apache module, then 755 vs 777 shouldn't make a difference.

    If the situation is more complicated then it may or may not make a difference.

    If you don't understand the ramifications of this then you may want to get some assistance administrating your server, for your own sake and your sites' security (not from me; I'm not looking for work).
     
    SmallPotatoes, Apr 1, 2009 IP
  5. zuemie

    zuemie Peon

    Messages:
    85
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ok. The reason i am asking is because when i file is uploaded, it is automatically moved to another folder when converted. When the folders and chmod 755 it says cannot move uploaded file. When the folders are chmod 777 i get an error that says cannot update database. So im not sure what is going on. Yet when i test it on a different server with a web host, all the folders are chmod 755 and everything works great, so im thinking it's something in the server configuration, but i could be wrong
     
    zuemie, Apr 1, 2009 IP
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #6
    It might be that the folders on the non-working server is set up with different user privileges than needed. For instance, if the owner of the folder is not the webserver/apache/php or something similar.

    755 should be enough for anybody, to paraphrase. You should really never have to have a 777-folder on the webserver.
     
    PoPSiCLe, Apr 1, 2009 IP
  7. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Sounds like you used the command-line rather than PHP to make the directory into which you're trying to call move_uploaded_file().

    Use 'ls -l' to look at a file or directory that was created with PHP and take note of the owner.

    Then use chown (as root) to make sure your move_uploaded_file() target directory has the same owner.
     
    SmallPotatoes, Apr 1, 2009 IP