From time to time,  Squirrelmail gives this error on a Plesk machine:

Error opening /var/lib/squirrelmail/prefs/default_pref
Could not create initial preference file!
/var/lib/squirrelmail/prefs/ should be writable by user apache
Please contact your system administrator and report this error.

Squirrelmail depends on safe_mode being off.  Let’s see if this is the case:

# grep ^safe_mode /etc/php.ini
safe_mode = On

Since this is a multi-domain system, we want to make changes only to the effected subdomain, in this case the webmail.* subdomain.  But changing the Plesk config won’t help, since Plesk will just overwrite it.   So we create a second file, that will load after, and thus override the Plesk file:

# vi /etc/httpd/conf.d/zz011_squirrelmail_safemode_fix.conf

And add the following:

<Directory "/usr/share/squirrelmail">
     php_admin_flag safe_mode off

Now check your apache config and restart gracefully:

# httpd -t
# apachectl graceful

You may also need to set the following in /usr/share/squirrelmail/config/config_local.php

$default_folder_prefix = 'INBOX.';

Reload Squirrelmail in your browser – it should work now

« »