Apache don't execute the files

Discussion in 'PHP' started by mehdiali, Nov 20, 2007.

  1. #1
    hi everyone
    image : !
    i have a upload center and let user upload their images.
    i use linux and apache.
    i've heard(i don't anything about it) that apache(on linux) can
    limit a folder so that files of folder just can download
    but can't execute(if someone even upload a php file he can't run this).
    so i don't need some filters and let users upload anything they want.
    i have two questions :
    1.is it true
    2.how can do this.
    thank you in advance
     
    mehdiali, Nov 20, 2007 IP
  2. phpl33t

    phpl33t Banned

    Messages:
    456
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Um, why not chmod 666 or 644 so they cannot be executed?
     
    phpl33t, Nov 20, 2007 IP
  3. serialCoder

    serialCoder Guest

    Best Answers:
    0
    #3
    hmm, if its an image upload script that you're running then you should probably just filter the files and only allow certain file formats for images
     
    serialCoder, Nov 20, 2007 IP
  4. mehdiali

    mehdiali Peon

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    uploaded files in mentioned folder can't run, they just can download !
     
    mehdiali, Nov 21, 2007 IP
  5. prosman

    prosman Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    reinstall apache!
    if rebuild php version or rebuild apache sometimes bugged.
     
    prosman, Nov 21, 2007 IP
  6. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #6
    Yes, so why don't you change permissions as phpl33t said?

    This might help:
    chmod -R 644 /path/to/upload_dir

    Or through your FTP client.
     
    krt, Nov 21, 2007 IP
  7. tonybogs

    tonybogs Peon

    Messages:
    462
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #7
    In regards to serialCoders comment.

    Just limiting the file format could be dangerous. Its still possible to execute something with a .jpg extension for example. Someone silly might ForceType the jpg type or access is directly through a script causing all sorts of havoc.

    Just a thought :)
     
    tonybogs, Nov 21, 2007 IP