Contact us

Using MySQL database for squirrelmail Global address book

This tutorial will Tweak php for squirrelmail use plus storing global addressbooks and preferences in a database.

Edit php.ini

This will set the upload and memory limits of php

[mylogin@hostname folder]# vi /etc/php.ini

upload_max_filesize = 20M
post_max_size = 20M # limit is 40M
memory_limit = 20M # limit is 40M

Below will make use of MySQL database for storing global addressbooks and preferences. First edit php.ini file.

[mylogin@hostname folder]# vi /etc/php.ini

locate:

;include_path = ".:/php/includes"

change to:

include_path = ".:/php/includes:/usr/share/pear"

Create a database in mysql named squirrelmail

[mylogin@hostname folder]# mysqladmin create squirrelmail

The squirrelmail database is now created. Next is login to mysql

[mylogin@hostname folder]# mysql -uroot -p

Issue this command in mysql console. Substitute the squirrelmailuser and its password as you would like

mysql> GRANT select,insert,update,delete ON squirrelmail.* TO squirreluser@localhost IDENTIFIED BY 'sqpassword';

Next create the tables needed to store the data. Now select the database tobe used.

mysql> use squirrelmail

Then copy and paste the code below and press then enter. Then quit MySQL This will create the Global addressbook table.

CREATE TABLE address (
owner varchar(128) DEFAULT '' NOT NULL,
nickname varchar(16) DEFAULT '' NOT NULL,
firstname varchar(128) DEFAULT '' NOT NULL,
lastname varchar(128) DEFAULT '' NOT NULL,
email varchar(128) DEFAULT '' NOT NULL,
label varchar(255),
PRIMARY KEY (owner,nickname),
KEY firstname (firstname,lastname)
);

Create Preferences table:

CREATE TABLE userprefs (
user varchar(128) DEFAULT '' NOT NULL,
prefkey varchar(64) DEFAULT '' NOT NULL,
prefval BLOB DEFAULT '' NOT NULL,
PRIMARY KEY (user,prefkey)
);

In squirrelmail configuration console. From main menu select Databases, then DNS for Address Book. Then enter this syntax:

[] mysql://squirreluser:sqpassword@localhost/squirrelmail

Also in DNS for Preferences enter thesame code. Take note of the format

mysql://user:password@host/database

Tell a friend

This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)

Bookmark and Share RSS News Feed