Error opening ../data/default_pref
Could not create initial preference file!
../data should be writable by user apache
Please contact your system administrator and report this error
* Make sure you have specified (using the configuration tool) your data directory.
* If you have your data directory outside of your htdocs tree (not in the SquirrelMail directory, which is advisable), make sure NOT to use relative paths when specifying it in conf.pl; please use the full absolute path; and if editing the file manually, make sure "SM_PATH ." is removed for absolute paths.
* Make sure both your data directory AND its contents are readable and writeable by the user that your web server runs as (unless you run PHP in safe mode - see below). That means checking TWO things: ownership and permissions.
** Sample permissions are as follows:
The data directory is:
drwxrwxr-x 3 apache apache 8192 Apr 18 22:57 data/
the default prefs file inside of it is:
-rw-rw-r-- 1 apache apache 82 Sep 18 2002 default_pref
** If you're running *nix, you can typically find out what user your web server is running as by doing this:
% ps -ef | grep httpd
apache 11812 7296 0 Nov11 ? 00:08:31 /usr/sbin/httpd -DSSL
In this example, the user we want is called "apache". So, make sure apache has ownership over the data directory and its contents:
chown -R apache data/
* If you have PHP's safe mode enabled, change ownership to be the same user that owns your PHP scripts instead of the web server user.
* Make sure that you are using the default php.ini file without any other modification. Securing php as shown at the following link http://www.security-focus.com/infocus/1706 can cause the Error Opening message if open_basedir and/or safe_mode are not properly configured.
* If you have done all of the above, and it still doesn't work, and you are running a linux like Fedora Core 4, that has SELinux, there here is what to do:
My data and attachment directories are outside of the html space, as recommended for security, and hence also outside of the space that squirrelmail, run by httpd, is allowed to access.
# chcon -t httpd_squirrelmail_t /usr/share/squirrelmail/attachments
# chcon -t httpd_squirrelmail_t /usr/share/squirrelmail/data
fixed the problem!
* For IIS make sure to add
to the Permission for the ..\Data\ directory.
My system runs Virtualmin and I've solved the issue by adding g+rw permission to file: /home/foo/domains/mail.foo/public_html/data/user.foo.pref
Hope it helps.