500 internal error if files has write permission in the group

Discussion in 'Installation/Configuration' started by Thomas Jensen, Jul 23, 2009.

  1. Thomas Jensen

    Thomas Jensen New Member

    Hi,

    I have a PHP site, which allows me to upload pictures.
    There's no trouble uploading the file, but the the file permissions on the picture is not "read by all groups", and the result is that i can't view the file in a browser.
    My first thought was the give the uploading PHP file permissions to write, but when i do that, i get an internal error 500.

    It's running in suPHP.
     
  2. Thomas Jensen

    Thomas Jensen New Member

    Please, anybody?
     
  3. Mark_NL

    Mark_NL New Member

    what does your apache error log tell you when you get the 500 error?
     
  4. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    This is one of the security mechanisms of suphp, you can change this in the suphp.conf file.
     
  5. Thomas Jensen

    Thomas Jensen New Member

    Okay, where do i find it?
     
  6. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Almost all linux config files are in /etc. As the program is named suphp, you will find the file in the directory /etc/suphp/

    And in case that you dont find a file on your server, just use the command locate. E.g.:

    locate suphp.conf
     
  7. Thomas Jensen

    Thomas Jensen New Member

    Found it, thanks, but:

    server1:/# locate suphp.conf
    -bash: locate: command not found

    The images is still only given read and write permissions for owner, and can't be viewed in the browser :(
     
  8. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Then this is a problem with your image upload script as the permissions of the file are set by the php script that uploads the file.
     
  9. Thomas Jensen

    Thomas Jensen New Member

    I use the same script which worked on another server, I've given the file chmod 777. It's a standard PHP (move_uploaded_file) script :/
     
  10. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Your problem is not the permissions of the upload script, your problem is that the upload script sets wrong permissions for the uploaded image file. Your upload script must contain a chmod command to set the permissions of the uploadedc image file correctly.
     
  11. Thomas Jensen

    Thomas Jensen New Member

    Okay, I've never done that before, why is it suddenly required? And how do i do it?
    thanks
     
  12. Thomas Jensen

    Thomas Jensen New Member

    I've changed to modPHP and now everything seems to work fine. But it still bothers me why it won't automatically do the file permissions in suPHP..
     
  13. Thomas Jensen

    Thomas Jensen New Member

  14. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    If you select to overwrite the config files during setup then all config files that had been configured during initial setup will be overwritten.
     

Share This Page