PHP Based sites not handling attachments correctly

Discussion in 'General' started by pebkac, Jul 21, 2011.

  1. pebkac

    pebkac Member

    Hi all,

    I have a couple of sites on ISPConfig3 running on Ubuntu. One site is a forum and the other is osTicket. Both of these sites have a problem when attachments are uploaded. They both accept the attachment just fine, the problem is that when a user downloads the file it becomes corrupt and not usable. For instance on the forum I have a pdf file and it uploads fine and I can pull the file down via ftp or other means and it opens fine. But when I download it through the forum page it downloads very quickly with a 0byte size and is not usable. I also have the osTicket system running and when users attach pictures they are in the ticket but when you go to open them it is not readable. I've seen this on two differens ISPConfig servers I have installed and I really would like some help in getting it to work.


  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Which php mode do you use for that website?
    Is suexec enabled in the website settings?
    Do you get any errors in the error.log of the website, when you upload a file?
  3. pebkac

    pebkac Member

    SuExec is checked, PHP mode is Fast-CGI.

    This is the error i get when I try and view an attachment:

    [Thu Aug 04 09:53:34 2011] [warn] [client] mod_fcgid: stderr: PHP Warning:  readfile(/var/www/clients/client1/web1/web/osticket/attachments/0811/5D2292FF8C00A00_Screen_shot_2011_08_02_at_3.53.28_PM.png): failed to open stream: Permission denied in /var/www/clients/client1/web1/web/osticket/scp/attachment.php on line 71, referer:
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post the output of:

    ls -la /var/www/clients/client1/web1/web/osticket/attachments/0811/
  5. pebkac

    pebkac Member

    Also the last error I posted was after I unchecked suEXEC, here it is with it on, and the way it has always been.
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, that explains the error. The attachments will only work when suexec is on.

    the reason for this error is that you switched off suexec. This caued the session to be written under a wrong user. To fix that, close all browser windows, open the browser again and login again to get a new session.
  7. pebkac

    pebkac Member

    Ok, I did that and redownloded the file and it does download and is the correct size but it will not display, windows picture viewer thinks it is damaged and wont display it.
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    And you are sure that the file is correct? Please upload a different file yourself to the system. Check the file in picture viewer before you uploaded it and then download it, safe it to disk (dont open it directly) and then try to open the saved file again.

Share This Page