Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2003
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Upload file permission problems.

    Guys/gals got a good one for you.


    Im using a PHP upload script that was previously working flawlessly. My host moved me to another server and now for some reason 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 site move, however i do know that permissions were set to: 644 by default when it was uploaded.

    The real problem is that a good deal of my site users cannot see their files when the permissions are set to 600, the get forbidden errors. Additionally i cant change the permissions back to 655, 777, 644 or anything. The only thing i can do is delete the file. I cant even download it through ftp.

    So my question is: Is there an apache setting that could affect this that might be different from my original server thats causing this problem? Its become a headache for me and i would like to get it resolved... Any ideas?
    Last edited by mymilkexpired; 10-09-2003 at 10:38 PM.

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,108
    Thanks
    11
    Thanked 101 Times in 99 Posts
    when you say you can't change the permissions .. how are you trying ? via script / SSH / FTP ?

    when you upload a file it should be 'owned' by apache ( usually 'nobody' ) and you should be able to chmod the file via script eg

    [PHP]
    <?php chmod( $uploaded_file , 0644 );?>
    [/PHP

    if you can't do that via script then apart from anything else...its weird and I would suggest an email to your host as they probably had something to do with it !

    (ps try creating the upload directory via script <?mkdir( $upload_dir , 0777 ) ;?> , and see if you have any more luck with that (& don't forget to chmod back to 0644 when finished doing stuff if you are on a shared host)
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    New Coder
    Join Date
    May 2003
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Right, the file is owned by 'nobody' but the strange part about resetting the permissions on the file is that if i use FTP to do it, it gives access is denied. If i try to do it through CPANEL it says access denied. However if i use the file upload thats apart of CPANEL it uploads with the correct permissions AND i can also change the permissions ot the file. Its an extremely strange and aggrevating problem.

    I spoke with the host yesterday about it and got him to reset the owner on the files so that i was owner and then corrected the permission problems, but we werent able to determine why it was doing this and not allowing me to change the permissions on the file after i uploaded them. Is this possibly a user rights problem?


    btw, thanks for the input!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •