Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #31  
Old 12th December 2011, 23:07
cbj4074 cbj4074 is offline
Senior Member
 
Join Date: Nov 2010
Posts: 395
Thanks: 30
Thanked 58 Times in 50 Posts
Default

Let's put this thread to bed already.

The most important thing to note regarding the tutorial at http://www.howtoforge.com/enabling-s...r-ubuntu-10.10 is that a key assumption is made: Apache is configured in CGI mode. If Apache is configured using one of the other modes, the instructions would need to be modified accordingly.

The sources of confusion are largely that:

a.) The tutorial does not specify which PHP mode to use.

b.) The tutorial is inaccurate if ISPConfig's default PHP mode, Fast-CGI, is selected.

c.) The fact that PHP configuration directives (open_basedir, where this tutorial is concerned) must be placed in different locations depending on the selected PHP mode.

d.) It is unnecessary to add the SquirrelMail directories to the open_basedir directives when using ISPConfig's default PHP mode, Fast-CGI, so that step of the tutorial is superfluous unless using CGI mode.

e.) In ISPConfig, the "PHP open_basedir" field length is limited, although there is no mention of this fact. As such, some portion of the value in that field may be truncated without warning. One way around this bug is to use Mod-PHP, in which case the open_basedir directive is specified in the Apache Directives box, which does not suffer from the same length limit.

f.) The tutorial fails to mention two additional directories that should be added to the open_basedir directive's value. The full list should be:

Code:
/usr/share/squirrelmail:/etc/squirrelmail:/etc/mailname:/etc/hostname
The problem with Apache sending the actual binary file "index.php" to the browser has to do with an incompatibility with the default SquirrelMail configuration and Apache's SuPHP module, which as mentes already suggested, can be disabled:

Quote:
Originally Posted by mentes View Post
I had a similar problem. My solution was:

a2dismod suphp
/etc/init.d/apache2 restart
With suPHP disabled, the SquirrelMail index page (index.php) is parsed properly and the login screen is accessible.

Basically, SquirrelMail should work if:

a.) PHP mode is CGI and the necessary directories are added to "PHP open_basedir" field in Sites -> Website -> example.com -> Options [tab], as described in the tutorial. (Even if suphp module is enabled, it is ignored in CGI mode.)

b.) PHP mode is Fast-CGI and the suphp Apache module is disabled. (Disabling this module prevents "index.php" from being sent to the browser as a file download. It should be noted that Apache can be configured to enable SquirrelMail to function with SuPHP enabled, if desired.)

c.) PHP mode is Mod-PHP and the necessary open_basedir directories are added to the "Apache Directives" field in Sites -> Website -> example.com -> Options [tab]. How this directive is defined depends on the Apache configuration. An example might be:

Code:
Alias /webmail /usr/share/squirrelmail
<Location /webmail>
php_admin_value open_basedir "/usr/share/squirrelmail:/etc/squirrelmail:/etc/mailname:/etc/hostname"
</Location>
If the appropriate directories are not added to PHP's open_basedir configuration directive, the SquirrelMail index page will state:

Code:
ERROR: Config file "config/config.php" not found. You need to configure SquirrelMail before you can use it.
The Apache logs will state (among other open_basedir errors):

Code:
PHP Warning:  file_exists(): open_basedir restriction in effect. File(config/config.php) is not within the allowed path(s): (/current/open_basedir/path) in /usr/share/squirrelmail/index.php on line 15
The bottom line is that to configure SquirrelMail properly, it is important to understand that ISPConfig offers several different modes of operation for Apache: FastCGI, CGI, Mod-PHP, and suPHP. Each mode has different configuration requirements.

Ovidiu, which mode is the site in question configured to use?

Last edited by cbj4074; 13th December 2011 at 01:25.
Reply With Quote
The Following 2 Users Say Thank You to cbj4074 For This Useful Post:
loadingjkr (25th July 2012), Ovidiu (13th December 2011)
Sponsored Links
  #32  
Old 12th December 2011, 23:57
cbj4074 cbj4074 is offline
Senior Member
 
Join Date: Nov 2010
Posts: 395
Thanks: 30
Thanked 58 Times in 50 Posts
Default

Now, let's address the issue of webmail.example.com vs. example.com/webmail.

For those who wish to access SquirrelMail at example.com/webmail, it is necessary to add the following to Apache's configuration:

Code:
Alias /webmail /usr/share/squirrelmail
The above snippet should be added to the "Apache Directives" field in Sites -> Website -> example.com -> Options [tab].

For those who wish to access SquirrelMail at webmail.example.com, see my posts in this thread: http://www.howtoforge.com/forums/showthread.php?t=55182
Reply With Quote
  #33  
Old 13th December 2011, 14:30
Ovidiu Ovidiu is offline
Senior Member
 
Join Date: Sep 2005
Posts: 1,270
Thanks: 84
Thanked 25 Times in 21 Posts
Default

Thanks for the great write-up. This should help the people with probs to get it working.

Now back to my configuration:

- All sites on this server are using Fast-CGI
- I disabled suPHP as stated above
- apache has been restarted

Its working now. Thanks a million for clarifying this issue.
Seriously your write-up above should be linked to the HowTo.
Reply With Quote
  #34  
Old 15th December 2011, 17:50
cbj4074 cbj4074 is offline
Senior Member
 
Join Date: Nov 2010
Posts: 395
Thanks: 30
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
  #35  
Old 3rd October 2012, 12:38
breauxlg breauxlg is offline
Junior Member
 
Join Date: Jul 2009
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
Default What did you do to fix this

I see that vibrancy and ovidiu have fixed their websites, but didn't post how. Mine is still broken. I get this:
<?php

/**
* 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>';
exit;
}

// If we are, go ahead to the login page.
header('Location: src/login.php');

?>
Reply With Quote
  #36  
Old 3rd October 2012, 13:38
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,794
Thanks: 840
Thanked 5,612 Times in 4,423 Posts
Default

Which tutorial did you use to install your server? If you follow the perfects etup to the letter, squirrelmail will work out of the box. The most likely reason for your problem is that you missed to install the apache mod_php package as described in the ispconfig perfect server guides.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #37  
Old 3rd October 2012, 17:37
cbj4074 cbj4074 is offline
Senior Member
 
Join Date: Nov 2010
Posts: 395
Thanks: 30
Thanked 58 Times in 50 Posts
 
Default

breauxlg, did you read my posts in this thread? They describe the problem and how to fix it in exhaustive detail.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix delivery problem erebus Installation/Configuration 8 29th July 2014 21:17
rkhunter warnings esezako General 7 27th September 2011 08:28
All my mail is going to /var/mail/vmail _sluimers_ Installation/Configuration 21 10th January 2011 14:21
Chroot SSH + ISPConfig Norman Installation/Configuration 27 26th March 2007 04:40
Systemimager (rsync) doesn't copy all comedit HOWTO-Related Questions 11 19th January 2007 18:17


All times are GMT +2. The time now is 16:46.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.