# Problem with SquirrelMail and Apache

## lazloman

After upgrading to Apache 2.2.4-r12, SquirrelMail would not allow me to log in. Also, when using this url:

```
http://<host>/squirrelmail/src/login.php
```

 I get the source served instead of the login screen. If I add a trailing /, I get the login screen, but after clicking OK, I get an error:

```

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

```

I've uninstalled/reinstalled SquirrelMail. Run webappconfig C/U/I and gone over my Apache config files, but SM still does not work. My gut tells me that Apache is somehow at fault, but I could be wrong. I've placed this directive in http.conf:

```

Alias /squirrelmail /usr/local/squirrelmail/www

<Directory /usr/local/squirrelmail/www>

  Options Indexes

  AllowOverride none

  DirectoryIndex index.php

  Order allow,deny

  allow from all

</Directory>

```

Adapted of course for my hostname and paths.

Any assistance would be greatly appreciated.

----------

## RayDude

 *lazloman wrote:*   

> After upgrading to Apache 2.2.4-r12, SquirrelMail would not allow me to log in. Also, when using this url:
> 
> ```
> http://<host>/squirrelmail/src/login.php
> ```
> ...

 

Chances are you overwrote your apache2 config with etc-update or dispatch-conf.

PHP doesn't appear to be loading.

Make sure you have this:

/etc/conf.d/apache2

```
APACHE2_OPTS="-D PHP5"
```

NOTE: you may have other -D opts in there, don't delete them unless you are sure you don't need them.

Also make sure you have the index enabled:

/etc/apache2/httpd.conf:

```
DirectoryIndex index.html index.html.var index.php
```

And, if you get an error message about the php module format being wrong, then you have to re-emerge PHP (with the apache2 use flag in make.conf, on the command line, or in the file /etc/portage/package.use).

I had to re-emerge SSL and PERL as well.

There may be other things wrong, just ask, I run apache and squirrel mail myself.

Raydude

----------

## lazloman

Sorry, I must not have been clear with my original post, but PHP pages do load properly. The rest of my PHP web pages work just fine. I have a problem with the SM login page: When I type the url w/o a trailing backslash, I get the page source. If I add the trailing slash, the page loads properly. Then after clicking the "login" button I get the error message in my original post.

----------

## snIP3r

hi lazloman!

i also have installed squirrelmail. but in my case i have to do a call via https... perhaps you should try https://...

but first comment your changes made in http.conf.

HTH

snIP3r

----------

## lazloman

Thanks for the reply, but I still get the same error. My Apache error log shows this:

```

configuration error:  couldn't perform authentication. AuthType not set!: /

```

Do you have any entries in your Apache config files for SM?

----------

## snIP3r

 *lazloman wrote:*   

> Thanks for the reply, but I still get the same error. My Apache error log shows this:
> 
> ```
> 
> configuration error:  couldn't perform authentication. AuthType not set!: /
> ...

 

no i do not have any entries in my httpd.conf nor in any other apache config files. the config error is normal. for ssl use you need to define an authtype.

you could try to comment the settings in your httpd.conf, restart apache and the try the https url.

HTH

snIP3r

----------

## lazloman

I made the change and the error now is

```

configuration error:  couldn't perform authentication. AuthType not set!: /squirrelmail/src/redirect.php, referer: https://myhost/squirrelmail/src/login.php

```

----------

## snIP3r

 *lazloman wrote:*   

> I made the change and the error now is
> 
> ```
> 
> configuration error:  couldn't perform authentication. AuthType not set!: /squirrelmail/src/redirect.php, referer: https://myhost/squirrelmail/src/login.php
> ...

 

hmmmm, i think you should try your former method and use the http url. there might be an issue with your ssl config. do you have enabled ssl and does it work with other sites on your server?

generally i would recommend to re-emerge php and then again squirrelmail after the upgrade of apache. this solved many problems.

HTH

snIP3r

----------

## lazloman

SquirrelMail is the only SSL site I use. I'll try re emerging php and squirrelmail

Thanks

----------

## lazloman

So, re-emerged php and squirrelmail, reinstalled both and ran webapp-config for squirrelmail and still can't login and my apache ssl_errorlog shows this:

```

 configuration error:  couldn't perform authentication. AuthType not set!: /squirrelmail/src/redirect.php, referer: https://myhost/squirrelmail/src/login.php

```

I'm dyin' out here!

----------

## RayDude

I'm going to get a bit more detailed now.

First in one of my vhosts (/etc/apache2/vhosts.d/some_file.conf) I have a redirect for my webmail domain...

```
<VirtualHost *:80>

   ServerName webmail.mydomain.org

   DirectoryIndex index.php

   RedirectMatch permanent ^/$ https://webmail.mydomain.org

</VirtualHost>
```

That makes sure all http access to webmail goes through a secure page.

Then in another vhost file:

```
<VirtualHost *:443>

   SSLEngine on

   SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

   SSLCertificateFile /etc/apache2/ssl/mydomain.org.crt

   SSLCertificateKeyFile /etc/apache2/ssl/mydomain.org.key

   SSLCertificateChainFile /etc/apache2/ssl/mydomain.org.crt

   ServerName webmail.mydomain.org

   DocumentRoot /usr/share/webapps/squirrelmail/1.5.1-r6/htdocs

   DirectoryIndex index.php

   <Directory /usr/share/webapps/squirrelmail/1.5.1-r6/htdocs>

     Options -Indexes FollowSymLinks MultiViews

     AllowOverride All

     <IfModule mod_access.c>

       Order allow,deny

       Allow from all

     </IfModule>

   </Directory>

</VirtualHost>
```

The data directory of webmail must be owned by apache so apache can write to it:

```
chown apache:apache -R /usr/share/webapps/squirrelmail/1.5.1-r6/htdocs/data
```

You also have to configure squirrelmail for pop or imap. I use imap, I like it better.

You also need ssl certificates. I get mine from cacert.org.

I'm probably forgetting something, but hopefully this will get you going.

Raydude

----------

