| 1 | Installing SquirrelMail |
| 2 | ======================= |
| 3 | |
| 4 | Table of Contents: |
| 5 | 1. (PHP4) Configure your webserver to work with PHP4 |
| 6 | 2. (IMAP) Setting up IMAP (not covered) |
| 7 | 3. (INSTALL) Obtaining and installing SquirrelMail |
| 8 | 4. (RUN) Running SquirrelMail |
| 9 | 5. (CHARSETS) Russian Charsets |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | 1. CONFIGURE YOUR WEBSERVER TO WORK WITH PHP4 |
| 15 | --------------------------------------------- |
| 16 | |
| 17 | If your webserver does not already have PHP4 you must configure it |
| 18 | to work with PHP4. SquirrelMail uses the standard suffix .php for |
| 19 | all PHP4 files. This is a quick and dirty guide to installing PHP4 |
| 20 | to run as CGI under Apache. How you end up doing this is up to you |
| 21 | (your mileage may vary). |
| 22 | |
| 23 | NOTE: The new plugin architecture required the use of some functions |
| 24 | which are not in all versions of PHP4. You will need at least |
| 25 | PHP4 v4.0.4. If you need to upgrade please go ahead and install the |
| 26 | latest release version of PHP4. |
| 27 | |
| 28 | a. Obtaining and compiling PHP4 |
| 29 | |
| 30 | Point your favorite webserver at http://www.php.net/version4/ and |
| 31 | download the source. Untar (tar xvfz filename-you-downloaded.tgz) |
| 32 | the source, cd into the directory and run configure. To make PHP4 |
| 33 | work with SquirrelMail a commandline like this should do: |
| 34 | |
| 35 | ./configure --enable-track-vars --enable-force-cgi-redirect --with-gettext |
| 36 | |
| 37 | If you have a database like MySQL you might want to add something |
| 38 | like --with-mysql to get database functionality. |
| 39 | |
| 40 | If you're going to use LDAP in the addressbook, you must compile PHP4 |
| 41 | with --with-ldap (see the PHP4 docs for more information). |
| 42 | |
| 43 | Run make to build the binary file. This will generate a binary file |
| 44 | called "php". Move this file into a CGI-directory. |
| 45 | |
| 46 | You might also want to read the INSTALL file in the PHP-distribution |
| 47 | :-) |
| 48 | |
| 49 | b. Changing php.ini |
| 50 | |
| 51 | PHP defaults to look for php.ini (PHP's configuration file) in |
| 52 | /usr/local/lib. However, for security reasons, it is suggested |
| 53 | that the location of this file is changed to someplace else. This |
| 54 | can be done at configure time with the configuration directive |
| 55 | --with-config-file-path=PATH. |
| 56 | |
| 57 | Edit the php.ini file and make sure session.use_cookies is 1. Also |
| 58 | be sure to change the session.save_path to someplace that can only |
| 59 | be read and written to by the webserver. session.save_path is the |
| 60 | location that PHP's session data will be written to. |
| 61 | |
| 62 | SECURITY WARNING - If a user has access to write PHP scripts on your |
| 63 | system and knows the location where PHP stores session data, he |
| 64 | could get a listing of the sessions being used and then read a given |
| 65 | session's data with his own PHP script. Caution should be used when |
| 66 | setting up permissions and locations of php.ini and the session data. |
| 67 | |
| 68 | FILE UPLOADS - Note that sending attachments will not work if your |
| 69 | "file_uploads" setting is "Off". Squirrelmail requires that setting |
| 70 | enabled in order to be able to attach files. |
| 71 | |
| 72 | c. Setting up .php files to use PHP4 |
| 73 | |
| 74 | You need to create a .htaccess file in you SquirrelMail directory |
| 75 | that looks something like this: |
| 76 | |
| 77 | AddType application/php4script .php |
| 78 | Action application/php4script /cgi-bin/php |
| 79 | |
| 80 | You could also add these lines to your Apache configuration file. |
| 81 | |
| 82 | d. Running into trouble |
| 83 | |
| 84 | Setting up Apache with PHP4 can be a non-trivial task. Read the PHP4 |
| 85 | and Apache documentation carefully if you run into trouble. If you |
| 86 | have an experienced system administrator around ask her/him to help |
| 87 | you. |
| 88 | |
| 89 | 2. SETTING UP IMAP |
| 90 | ------------------ |
| 91 | |
| 92 | This is not covered here :-/ |
| 93 | |
| 94 | 3. OBTAINING AND INSTALLING SQUIRRELMAIL |
| 95 | ---------------------------------------- |
| 96 | |
| 97 | SquirrelMail is still under development. Therefore you should always |
| 98 | get the newest version around. Look at |
| 99 | http://www.squirrelmail.org/index.php3?page=5 to see what it |
| 100 | is. If you want to be bleeding edge you might want to consider using |
| 101 | the latest CVS version (with the latest and most fashionable of |
| 102 | bugs). |
| 103 | |
| 104 | a. Download SquirrelMail |
| 105 | |
| 106 | Get SquirrelMail from the address above if you do not have it or are |
| 107 | uncertain if you have the newest version. Untar (again tar xvfz |
| 108 | filename.tgz) SquirrelMail in a directory that is readable for your |
| 109 | webserver. |
| 110 | |
| 111 | b. Setting up directories |
| 112 | |
| 113 | SquirrelMail uses two directories to store user configuration and |
| 114 | attachments that are about to be sent. You might want to have these |
| 115 | directories outside of your web tree. |
| 116 | |
| 117 | The data directory is used for storing user preferences, like |
| 118 | signature, name and theme. When unpacking the sources this directory |
| 119 | is created as data/ in your SquirrelMail directory. This directory |
| 120 | must be writable by the webserver. If your webserver is running as |
| 121 | the user "nobody" you can fix this by running: |
| 122 | |
| 123 | $ chown -R nobody data |
| 124 | $ chgrp -R nobody data |
| 125 | |
| 126 | Keep in mind that with different installations, the web server could |
| 127 | typically run as userid/groupid of nobody/nobody, nobody/nogroup, |
| 128 | apache/apache or www-data/www-data. The best way to find out is to read |
| 129 | the web server's configuration file. |
| 130 | |
| 131 | There also needs to be a directory where attachments are stored |
| 132 | before they are sent. Since personal mail is stored in this |
| 133 | directory you might want to be a bit careful about how you set it |
| 134 | up. It should be owned by another user than the webserver is running |
| 135 | as (root might be a good choice) and the webserver should have write |
| 136 | and execute permissions on the directory, but should not have read |
| 137 | permissions. You could do this by running these commands (still |
| 138 | granted that the webserver is running as nobody/nobody) |
| 139 | |
| 140 | $ cd /var/some/place |
| 141 | $ mkdir SomeDirectory |
| 142 | $ chgrp -R nobody SomeDirectory |
| 143 | $ chmod 730 SomeDirectory |
| 144 | |
| 145 | If you trust all the users on you system not to read mail they are |
| 146 | not supposed to read change the last line to chmod 777 SomeDirectory |
| 147 | or simply use /tmp as you attachments directory. |
| 148 | |
| 149 | If a user is aborting a mail but has uploaded some attachments to it |
| 150 | the files will be lying around in this directory forever if you do not |
| 151 | remove them. To fix this, it is recommended to create a cron job that |
| 152 | deletes everything in the attachment directory. Something similar |
| 153 | to the following will be good enough: |
| 154 | |
| 155 | $ cd /var/attach/directory |
| 156 | $ rm -f * |
| 157 | |
| 158 | However, this will delete attachments that are currently in use by people |
| 159 | sending email when the cron job runs. You can either (1) make sure that |
| 160 | the cron job runs at an obscure hour and hope that nobody gets upset, or |
| 161 | (2) you can run a modified version of the commands above. Check out the |
| 162 | man pages for other commands such as 'find' or 'tmpreaper'. |
| 163 | |
| 164 | One sample script you could set up that would erase all attachments, but |
| 165 | wouldn't erase preferences, address books, or the like (just in case your |
| 166 | attachment directory is the same as your data directory) might look like |
| 167 | this: |
| 168 | |
| 169 | $ rm `find /var/attach/directory -atime +2 | grep -v "\." | grep -v _` |
| 170 | |
| 171 | Remember to be careful with whatever method you do use, and to test out |
| 172 | the command before it potentially wipes out everyone's preferences. |
| 173 | |
| 174 | c. Setting up SquirrelMail |
| 175 | |
| 176 | There are two ways to configure Squirrelmail. In the config/ directory, |
| 177 | there is a perl script called conf.pl that will aid you in the |
| 178 | configuration process. This is the recommended way of handling |
| 179 | the config. |
| 180 | |
| 181 | You can also copy the config/config_default.php file to config/config.php |
| 182 | and edit that manually. |
| 183 | |
| 184 | 4. RUNNING SQUIRRELMAIL |
| 185 | ----------------------- |
| 186 | |
| 187 | Point your browser at the URL at which SquirrelMail is installed. A |
| 188 | possible example of this is: |
| 189 | http://www.yourdomain.com/squirrelmail |
| 190 | |
| 191 | It should be pretty straight forward to use. Some more documentation |
| 192 | might show up one day or another. |
| 193 | |
| 194 | |
| 195 | 5. RUSSIAN CHARSETS |
| 196 | ------------------- |
| 197 | |
| 198 | For information on how to make SquirrelMail work with Russian |
| 199 | Apache, see the README.russian_apache in the doc/ subdirectory. |