How To Set Up PHPList With Template

From OpenLiteSpeed Wiki

Revision as of 18:53, 13 November 2014 by Marmstrong (talk | contribs)

In the following article we will guide you through the steps to set up virtual hosts running phpList, an open source mailing list management system written in PHP. The first part of this article will cover importing the template. After the template is imported, you just need to create virtual hosts for each domain you want to run with phpList and install phpList in those virtual hosts. (Detailed phpList installation instructions can be found at

Note: Any setting not specifically noted in this walkthrough can be left as the default.

Import the phplist template

1. Download the phplist template file.

2. Save the template file to /usr/local/lsws/conf/templates/phplist.xml.

3. Make sure user lsadm has write permission.

chown lsadm /usr/local/lsws/conf/templates/phplist.xml

4. Add the template on the WebAdmin console.

WebAdmin console > Configuration > Virtual Host Templates > Add
Template Name: phplist (name it anything as long as it does not conflict with existing templates)
Template File: $SERVER_ROOT/conf/templates/phplist.xml
Mapped Listeners: Default
Note: In order for the server to direct traffic to the proper vhost, you must have listeners set up to listen on the proper IP and port. When you use a virtual host template, you do not have to define listener-to-virtual host mappings in the listener settings. Instead you set the mapped listeners when adding a template. In the above settings, we have used the listener "Default", which is set up to listen on port 8088 of "ANY" IP by default. You must adjust your listener settings to make sure there are listeners on the IP and ports you need. (The easiest way to do this is for most sites to just change the port setting to "80" for the Default listener in WebAdmin console > Configuration > Listeners > Default > General. This gives you a listener listening on port 80 of all IPs.)

5. Graceful restart to apply changes. (Actions > Graceful Restart)

Set up virtual hosts using the template

1. Create a member virtual host from the template.

WebAdmin console > Configuration > Virtual Host Templates > phplist > Member Virtual Hosts > Add
Virtual Host Name: test1
Note: We have named our phpList vhost "test1". You can name it whatever you want, but remember to then replace any instances of "test1" in this tutorial with the name of your virtual host.

2. Create directories for this vhost.

As the root user, run the following commands:
mkdir -p /usr/local/lsws/test1/{html,logs,conf}
chown lsadm:lsadm /usr/local/lsws/test1/conf

3. Graceful restart to apply changes. (Actions > Graceful Restart)

Your new vhost is now live and ready for phpList. All you have to do is install them.

Install phplist

1. RPM install.

yum install mysql mysql-server libxml2-devel gd-devel gcc gcc-c++ make patch

2. Build PHP.

Build PHP (5.3.26, for example) with additional modules.
Go to the WebAdmin Console > Actions > Compile PHP
'--with-mysqli' '--with-zlib' '--with-gd' '--enable-shmop' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-magic-quotes' '--enable-mbstring' '--with-iconv' '--with-mysql' '--with-imap=shared' '--with-curl' '--with-libdir=lib64' '--with-kerberos' '--with-imap-ssl'
Note: '--with-libdir=lib64' is for x86_64 systems.
Graceful restart to apply changes. (Actions > Graceful Restart)

3. Download phpList (the latest version is 2.10.19 as of writing) into your virtual host document root: /usr/local/lsws/test1/html

cd /usr/local/lsws/test1/html
tar zxf phplist-2.10.19.tgz
cp -rp phplist-2.10.19/public_html/lists .
rm phplist-2.10.19 phplist-2.10.19.tgz

4. Set up a MySQL database and user for phpList.

yum install mysql mysql-server
service mysqld start
mysql -u adminusername -p
mysql> create database phplist
mysql> grant all privileges on phplist.* to db_user@'localhost' identified by 'password'

5. Graceful restart to apply changes. (Actions > Graceful Restart)

6. Point your browser to http://localhost:8088/lists/admin/index.php to run the phpList installer.

For a detailed configuration guide, go to

7. Once you have completed, your newly installed phpList will be accessible from http://server_ip:8088/lists/.