Squirrelmail downloads file...

Discussion in 'General' started by vibrancy, Mar 26, 2011.

  1. vibrancy

    vibrancy Member

    Main hard drive on my server crashed the other day, so finally get to upgrade to Debian 6 and ISPConfig3 - i'm excited!

    Spent most of yesterday fiddling around and getting acclimated to the new system and I had pretty much everything working flawlessly. I was able to send/receive e-mails no problem, access websites, etc...

    Today though, nothing has changed mind you... now when I try to access my webmail it downloads a file instead of going to the site. Absolutely no settings have been changed manually... so what is going on here?


    You can see what I mean... any help would be greatly appreciated!

    Found another thread mentioning the same issue, although his resolution was just simply reinstalling everything, which is not a great solution =\

    I did make sure PHP is enabled for the site, have tried a few different settings all to no avail, tried FAST-cgi, mod-PHP, and suPHP but none worked, also checked permissions and "chmod 770 /var/lib/squirrelmail/data/" but nothing again... same result regardless of entering ip address vs domain name...
    Last edited: Mar 26, 2011
  2. falko

    falko Super Moderator ISPConfig Developer

  3. Ovidiu

    Ovidiu Active Member

    exactly the same problem here. test it here: http://zice.ro/webmail
    file gets downloaded and the content of that file says:

     * index.php
     * Redirects to the login page.
     * @copyright 1999-2010 The SquirrelMail Project Team
     * @license http://opensource.org/licenses/gpl-license.php GNU Public License
     * @version $Id: index.php 13893 2010-01-25 02:47:41Z pdontthink $
     * @package squirrelmail
    // Are we configured yet?
    if( ! file_exists ( 'config/config.php' ) ) {
        echo '<html><body><p><strong>ERROR:</strong> Config file ' .
            '&quot;<tt>config/config.php</tt>&quot; not found. You need to ' .
            'configure SquirrelMail before you can use it.</p></body></html>';
    // If we are, go ahead to the login page.
    header('Location: src/login.php');
    but the webmail can perfectly fine be accessed via: https://h1870666.stratoserver.net:8080/webmail/

    the vhost of zice.ro is:

    <Directory /var/www/zice.ro>
        AllowOverride None
        Order Deny,Allow
        Deny from all
    <VirtualHost *:80>
          DocumentRoot /var/www/zice.ro/web
        ServerName zice.ro
        ServerAlias *.zice.ro
        ServerAlias *.zice.md zice.md
        ServerAlias fisiere.zice.ro
        ServerAdmin [email protected]
        ErrorLog /var/log/ispconfig/httpd/zice.ro/error.log
        <Directory /var/www/zice.ro/web>
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
        <Directory /var/www/clients/client1/web1/web>
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
        # suexec enabled
        SuexecUserGroup web1 client1
        # Clear PHP settings of this website
        <FilesMatch "\.ph(p3?|tml)$">
            SetHandler None
        # php as fast-cgi enabled
        <IfModule mod_fcgid.c>
              # SocketPath /tmp/fcgid_sock/
              # IdleTimeout n (3600 seconds)
              # An idle fastcgi application will be terminated after IdleTimeout seconds.
          IdleTimeout 3600
              # ProcessLifeTime n (7200 seconds)
          # A fastcgi application will be terminated if lifetime expired, even no error is detected.
          ProcessLifeTime 7200
              # MaxProcessCount n (1000)
          # The max count of total fastcgi process count.
          # MaxProcessCount 1000
              # DefaultMinClassProcessCount n (3)
          # The minimum number of fastcgi application instances for any one fastcgi application.
          # Idle fastcgi will not be killed if their count is less than n
          # Set this to 0, and tweak IdleTimeout
              DefaultMinClassProcessCount 0
              # DefaultMaxClassProcessCount n (100)
          # The maximum number of fastcgi application instances allowed to run for
          # particular one fastcgi application.
          DefaultMaxClassProcessCount 100
              # IPCConnectTimeout n (3 seconds)
          # The connect timeout to a fastcgi application.
          IPCConnectTimeout 8
              # IPCCommTimeout n (20 seconds)
          # The communication timeout to a fastcgi application. Please increase this
          # value if your CGI have a slow initialization or slow respond.
          IPCCommTimeout 360
              # BusyTimeout n (300 seconds)
          # A fastcgi application will be terminated if handing a single request
          # longer than busy timeout.
              BusyTimeout 300
        <Directory /var/www/zice.ro/web>
            AddHandler fcgid-script .php .php3 .php4 .php5
            FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter .php
            Options +ExecCGI
            AllowOverride All
            Order allow,deny
            Allow from all
            <Directory /var/www/clients/client1/web1/web>
            AddHandler fcgid-script .php .php3 .php4 .php5
            FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter .php
            Options +ExecCGI
            AllowOverride All
            Order allow,deny
            Allow from all
        RewriteEngine on
        RewriteCond %{HTTP_HOST}   ^fisiere.zice.ro [NC]
        RewriteRule   ^/(.*)$ /fisiere/$1  [L]
        # add support for apache mpm_itk
        <IfModule mpm_itk_module>
          AssignUserId web1 client1
        <IfModule mod_dav_fs.c>
          # WEBDAV BEGIN
          # WEBDAV END
    <IfModule mod_fcgid.c>
       IPCConnectTimeout 300
       IPCCommTimeout 360
       MaxRequestLen 16777216
    and the ls -al of the root web folder is too long to post here, what specifically are you looking for?

    btw. I followed this howto: http://www.howtoforge.com/enabling-...b-sites-on-an-ispconfig-3-server-ubuntu-10.10

    maybe this info helps:

    h1870666:/etc/squirrelmail# ls -al
    total 80
    drwxr-xr-x   2 root root  4096 Apr 14 10:57 .
    drwxr-xr-x 108 root root  4096 Apr 14 10:35 ..
    -rw-r--r--   1 root root  1145 Mar  6 18:52 apache.conf
    lrwxrwxrwx   1 root root     7 Apr 14 10:57 config -> config/
    -rw-r--r--   1 root root 31242 Jul 31  2010 config_default.php
    -rw-r--r--   1 root root   459 Jul 31  2010 config_local.php
    -rw-r--r--   1 root root  8401 Mar  6 18:44 config.php
    lrwxrwxrwx   1 root root    32 Mar  6 18:43 conf.pl -> /usr/sbin/squirrelmail-configure
    -rw-r--r--   1 root root    41 Jul 31  2010 default_pref
    -rw-r--r--   1 root root  6583 Jul 31  2010 filters_setup.php
    -rw-r--r--   1 root root   478 Jul 31  2010 index.php
    -rw-r--r--   1 root root  1654 Jul 31  2010 sqspell_config.php
    h1870666:/etc/squirrelmail# cd config
    bash: cd: config: Too many levels of symbolic links
    oh and I do have added the right entries /user/share/squirelmail and /etc/squirrelmail to my php_open_base_dir variable.
    also fixed the above symlinks problem by removing and re-installing squirrelmail according to the ispcfg3 tutorial..
    Last edited: Apr 14, 2011
  4. falko

    falko Super Moderator ISPConfig Developer

    Does it work with mod_php?
  5. Ovidiu

    Ovidiu Active Member

    how would I test that? The squirrelmail config file for apache loads as an alias for all sites...
    I don't want to set all my sites to mod_php :)

    I have set one site to mod_php, waited for the changes to be saved to file and tried: still the same result...
  6. Ovidiu

    Ovidiu Active Member

    any other ideas?
  7. Ovidiu

    Ovidiu Active Member

    nothing? sorry for bumping again, will just leave it be if I don't get an answer this time :-(
  8. erosbk

    erosbk New Member

    AddHandler application /x-httpd-php .php .php3 .php4 .php5

    You have to add that line in the conf file of squirrelmail (for roundcube, I used an htaccess file in program folder.)

    That line force squirrelmail to use php_mod instead of xxx_mod configured in your virtual sites.
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Another solution is to edit the file:


    and change the lines:

    AddType application/x-httpd-suphp .php .php3 .php4 .php5 .phtml
    suPHP_AddHandler application/x-httpd-suphp


    #AddType application/x-httpd-suphp .php .php3 .php4 .php5 .phtml
    #suPHP_AddHandler application/x-httpd-suphp

    and then restart apache.
  10. Ovidiu

    Ovidiu Active Member

    didn't work, any other ideas or did I do anything wrong?

    here is my squirrelmail conf file:

    Alias /webmail /usr/share/squirrelmail

    <Directory /usr/share/squirrelmail>
    AddHandler application /x-httpd-php .php .php3 .php4 .php5
    Options FollowSymLinks
    <IfModule mod_php5.c>
    php_flag register_globals off
    <IfModule mod_dir.c>
    DirectoryIndex index.php

    # access to configtest is limited by default to prevent information leak
    <Files configtest.php>
    order deny,allow
    deny from all
    allow from
  11. erosbk

    erosbk New Member

    It never will work in that way xD

    The same happened to me for roundcube. The vhosts "sethandler none" used to reset php handler, is being read by apache2 AFTER the conf file for roundcube (same for squirrelmail. If you add a handler there, when a user access through a vhost, the handler is reset by the vhost conf file...

    The solution is to add the handler AFTER :p

    go to /usr/share/squirrelmail and see if you have an .htaccess there... add the line at first line in the file. Or see if you have an index php, or whatever, an add the line there :p

    Or just create a .htaccess there :p

  12. till

    till Super Moderator Staff Member ISPConfig Developer

    Just do what I told you in #9 and remove the addhandler line that you added in the other file.
  13. Ovidiu

    Ovidiu Active Member

    I am sorry Till, I missed your answer.
    I have tried it now but it did not work. same problem.

    btw. how would that work? None of my vhosts uses suphp all use fastcgi with suexec...

    and wouldn't your change break all suphp enabled vhosts?
  14. Ovidiu

    Ovidiu Active Member

    I need to get squirrelmail going.
    anyone got more tips?

    I just realized that when I go to ispcfg3 => system => server config, the field called PHP open_basedir is limited in length???

    I tired inputting this string:

    [website_path]/web:[website_path]/tmp:/var/www/[website_domain]/web:/srv/www/[website_domain]/web:/usr/share/php5:/usr/share/php/PEAR:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/usr/share/php:/var/www/piwik:/usr/share/squirrelmail:/etc/squirrelmail but it gets automatically cut off
    can anyone confirm?
    Last edited: Jun 21, 2011
  15. erosbk

    erosbk New Member

    Try to add in .htaccess inside directory /usr/share/squirrelmail, the following:
    AddHandler application /x-httpd-php .php .php3 .php4 .php5

    Or add it as the first line if you have another file with directives in squirrelmail directory.

    As I could see in roundcube (and others...), setting for vhosts are being read AFTER conf files in apache2... so... with you settings, apache2 reads the addhandler, and next, reads your vhost conf where addhanlder are set to none... so, it will never work, only will work if you set the addhandler AFTER vhost is read...

  16. Ovidiu

    Ovidiu Active Member

    added this line: AddHandler application /x-httpd-php .php .php3 .php4 .php5

    into /usr/share/squirrelmail/.htaccess , restartet apache2, no change :-(
  17. fordwrench

    fordwrench Member

    anyone ever get this figured out...
    I am having the same problem and have tried all these examples and non work.

  18. falko

    falko Super Moderator ISPConfig Developer

    In which directory is SquirrelMail located? Can you post the vhost configuration of the vhost where you get the file as a download?
  19. rlarge

    rlarge New Member


    I'm having the same problem.... On the main site on the server everything works great but on sites added its like the php isn't being loaded after you choose the one you want. There are a couple threads that are trying to resolve this problem... I will not give up :)

    Alright got it to work... don't know if its right but comment and tell me what i did wrong...

    went to /etc/apache2/sites-available/(whatever your sites name is).vhost


    # Clear PHP settings of this website
    <FilesMatch "\.ph(p3?|tml)$">
    SetHandler None


    # Clear PHP settings of this website
    <FilesMatch "\.ph(p3?|tml)$">
    AddHandler application /x-httpd-php .php .php3 .php4 .php5

    it works for now...:)
    Last edited: Aug 2, 2011
  20. rlarge

    rlarge New Member


    Never mind it get rewritten after restart and login to ispconfig.....

    As long as i don't change anything is the site tab it works... so keeping for now but still wonder why that works like that...
    Last edited: Aug 2, 2011

Share This Page