View Single Post
  #34  
Old 15th December 2011, 17:50
cbj4074 cbj4074 is offline
Senior Member
 
Join Date: Nov 2010
Posts: 392
Thanks: 29
Thanked 58 Times in 50 Posts
Default

You're welcome. Glad to hear that your issue is resolved.

At this point, it seems prudent to address the root cause of the problem with the SquirrelMail index.php file being presented to the user-agent as a download.

From what I gather, somewhere in the Apache configuration files, suphp is being disabled for the SquirrelMail directory, which is fine. The problem is that a PHP handler is not registered subsequently, so Apache makes no attempt to parse PHP files and instead presents them to the browser as binary attachments.

I should add that this same issue likely affects phpMyAdmin installations, because a) its files are stored outside of Apache's Document Root in some Linux distributions (e.g., in /usr/share/phpmyadmin), and b) PMA is presumably exempted from suphp restrictions (but, again, no PHP handler is registered subsequently).

There are two solutions to this problem.

First, the "quick-and-dirty" solution: disable the suphp module for the SquirrelMail directory (even if it's already disabled) and add a proper PHP handler:

Code:
Alias /squirrelmail /usr/share/squirrelmail
<Location /squirrelmail>
<IfModule suphp_module>
suPHP_Engine Off
AddHandler php5-script	.php
</IfModule>
php_admin_value open_basedir "/usr/share/squirrelmail:/etc/squirrelmail:/etc/mailname:/etc/hostname"
</Location>
The second solution is to configure suphp "properly". The first step is to re-enable suphp for the SquirrelMail directory, since it's being disabled somewhere (which could be in SquirrelMail's .conf file, an ISPConfig file... I haven't looked):

Code:
Alias /squirrelmail /usr/share/squirrelmail
<Location /squirrelmail>
<IfModule suphp_module>
suPHP_Engine on
suPHP_AddHandler x-httpd-php
AddHandler x-httpd-php .php
</IfModule>
php_admin_value open_basedir "/usr/share/squirrelmail:/etc/squirrelmail:/etc/mailname:/etc/hostname"
</Location>
The second step is to modify the suphp configuration accordingly. While this post addresses phpMyAdmin, all of the same points apply to SquirrelMail:

http://hartlessbydesign.com/blog/vie...and-phpmyadmin

Problem solved!
Reply With Quote