Saltar al contenido

Instalar PHPlist

1 Preliminary Note

I asume that you’ve at least set up a standard LAMP system and a mailserver. If not, you should first take a look at our «Virtual Users And Domains» howtos. Additionally you have to install the PHP imap package («php-imap» on Fedora/CentOS; «php5-imap» on Debian/Ubuntu).

 

2 Apache Vhost

2.1 Fedora/CentOS

We’ll create a standard vhost for phplist.

vi /etc/httpd/conf.d/vhosts.conf

It could look like this:

NameVirtualHost 192.168.0.100:80

<VirtualHost 192.168.0.100:80>
    ServerName www.example.com
    ServerAdmin admin@example.com
    DocumentRoot /var/www/www/web

    LogLevel warn
    ErrorLog logs/www_error.log
    CustomLog logs/www_access.log combined

</VirtualHost>

Next create the document root for this vhost.

mkdir -p /var/www/www/web/

After that restart the webserver.

service httpd restart

 

2.2 Ubuntu/Debian

We’ll create a standard vhost for phplist.

vi /etc/apache2/sites-available/phplist

It could look like this:

NameVirtualHost 192.168.0.100:80

<VirtualHost 192.168.0.100:80>

    ServerName www.example.com
    ServerAdmin admin@example.com
    DocumentRoot /var/www/www/web

    LogLevel warn
    ErrorLog /var/log/apache2/www_error.log
    CustomLog /var/log/apache2/www_access.log combined

</VirtualHost>

Next create the document root for this vhost.

mkdir -p /var/www/www/web/

After that enable the vhost and restart the webserver.

a2ensite phplist
/etc/init.d/apache2 restart

 

3 MySQL User & Database

Now we have to create a database for PHPlist …

mysqladmin -u root -p create phplist

… and a user for this database.

mysql -u root -p
%sql_root_password%

 
 

GRANT CREATE, ALTER, INDEX, DROP, CREATE TEMPORARY TABLES, SELECT, INSERT, UPDATE, DELETE ON phplist.* TO ‘phplist_admin’@’localhost’ IDENTIFIED BY ‘%phplist_admin_password%’;
GRANT CREATE, ALTER, INDEX, DROP, CREATE TEMPORARY TABLES, SELECT, INSERT, UPDATE, DELETE ON phplist.* TO ‘phplist_admin’@’localhost.localdomain’ IDENTIFIED BY ‘%phplist_admin_password%’;
FLUSH PRIVILEGES;

quit;

 

4 PHPlist

4.1 Note

In step 4.3 you’ll need a vaild email address that will be used by PHPlist to catch all bounced mails – in this example I’ll use «listbounces@example.com». So create an email address for this special purpose and proceed.

 

4.2 Get It

Please have a look at http://www.phplist.com/download to find out which is the latest stable version – when I was writing this howto it was version 2.10.5.

cd /tmp/
wget http://mesh.dl.sourceforge.net/sourceforge/phplist/phplist-2.10.5.tgz
tar xvfz phplist-2.10.5.tgz
cp -R /tmp/phplist-2.10.5/public_html/* /var/www/www/web/

Please note that the main page (e.g.: http://www.example.com) contains a dummy page that redirects to the phplist page – you might want to replace it with your own website.

 

4.3 Basic Configuration

vi /var/www/www/web/lists/config/config.php

 

4.3.1 Database Settings

Adjust the following variables so that they fit to your setup (step 3).

E.g.:

$database_name = «phplist»;
$database_user = «phplist_admin»;
$database_password = «howtoforge»;

 

4.3.2 Bounces

Adjust the following variables so that they fit to your setup (step 4.1).

E.g.:

$message_envelope = «listbounces@example.com»;
$bounce_mailbox_user = «listbounces@example.com»;
$bounce_mailbox_password = «howtoforge»;

 

4.3.3 Security

Adjust the following variable.

$check_for_host = 1;

 

4.3.4 Debug

The test-mode is enabled by default which means that no emails will be sent, but the system pretends to do so. You have to disable this later, when you tested your setup:

define(«TEST»,0);

 

4.3.5 Other Settings

Please have a look at all the other settings. They are well explained – maybe you want to change some settings.