How To Install PHPList on Rocky Linux 9
In this tutorial, we will show you how to install PHPList on Rocky Linux 9. PHPList is an open-source email marketing and newsletter management tool widely used by businesses and organizations to manage mailing lists and distribute newsletters efficiently. As an email marketing solution, it offers robust features for subscriber management, campaign creation, and email tracking. Rocky Linux 9, being a stable and enterprise-ready distribution, provides an excellent platform for hosting PHPList. In this comprehensive guide, we’ll walk through the complete process of installing PHPList on Rocky Linux 9, from system preparation to final configuration.
Introduction to PHPList
PHPList stands out among email marketing solutions due to its self-hosted nature, which gives you complete control over your subscriber data and email campaigns. Built with PHP and using MySQL as its database backend, PHPList offers features like subscriber management, campaign creation, email tracking, and analytics-all without the recurring costs associated with commercial email marketing services.
When installed on Rocky Linux 9, PHPList can leverage the stability and security of this enterprise-class Linux distribution, providing a reliable platform for your email marketing needs. This installation guide will take you through each step required to get PHPList up and running on your Rocky Linux 9 server.
Prerequisites
Before beginning the installation process, ensure you have the following:
- A Rocky Linux 9 server with root or sudo privileges
- SSH access to your server
- A domain name pointing to your server (recommended for production use)
- Basic knowledge of Linux command line operations
- Minimum system requirements: 2GB RAM, 2 CPU cores, 20GB disk space
These requirements ensure smooth operation of both the operating system and PHPList application.
Step 1: Update Rocky Linux 9 System
Starting with a fully updated system is critical for security and compatibility. Follow these steps to update your Rocky Linux 9 server:
# Update package information index
sudo dnf update -y
This command refreshes the package database and upgrades all installed packages to their latest versions.
Additionally, consider implementing these basic security configurations before proceeding:
# Enable and start the firewall
sudo systemctl enable firewalld
sudo systemctl start firewalld
# Check firewall status
sudo firewall-cmd --state
A properly updated system forms the foundation for a secure and stable PHPList installation.
Step 2: Install Required Repositories
Rocky Linux 9 repositories don’t include all the packages needed for PHPList. We’ll add the EPEL (Extra Packages for Enterprise Linux) and Remi repositories to access the latest PHP versions and additional required packages.
# Install EPEL repository
sudo dnf install epel-release -y
# Install Remi repository
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
# Verify repository installation
dnf repolist | grep -E 'epel|remi'
You should see output confirming that both repositories are now available. The output should include entries for epel, epel-cisco-openh264, remi-modular, and remi-safe.
Next, reset the PHP module to prepare for installation:
# Reset PHP module
sudo dnf module reset php -y
These repositories provide access to the latest PHP packages and dependencies required by PHPList, ensuring compatibility and security.
Step 3: Install PHP 8 on Rocky Linux 9
PHPList requires PHP with several extensions to function properly. We’ll install PHP 8.4 (the latest stable version as of May 2025) from the Remi repository.
# Enable PHP 8.4 from Remi repository
sudo dnf module enable php:remi-8.4 -y
# Install PHP CLI and core packages
sudo dnf install php php-cli -y
# Install essential PHP extensions required by PHPList
sudo dnf install php-common php-mbstring php-xml php-curl php-zip php-opcache php-mysqli -y
After installation, verify the PHP version:
# Check PHP version
php -v
The output should confirm PHP 8.4.x is installed. PHPList requires specific PHP extensions to function properly, including:
- php-mbstring: For handling multibyte character strings
- php-xml: For XML parsing
- php-curl: For making HTTP requests
- php-zip: For handling zip files
- php-mysqli: For MySQL database connection
- php-opcache: For improved PHP performance
This combination of PHP and extensions provides the optimal environment for running PHPList efficiently.
Step 4: Install and Configure Web Server
PHPList requires a web server to function. Apache is a popular choice for hosting PHP applications:
# Install Apache web server
sudo dnf install httpd -y
# Start and enable Apache service
sudo systemctl start httpd
sudo systemctl enable httpd
# Check Apache status
sudo systemctl status httpd
Configure Apache to work with PHP by creating a configuration file:
# Create PHP configuration file for Apache
sudo nano /etc/httpd/conf.d/php.conf
Add the following content:
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Save and close the file. Configure the firewall to allow HTTP traffic:
# Allow HTTP through the firewall
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
Test the web server by creating a simple PHP info file:
# Create a PHP info file
echo "" | sudo tee /var/www/html/info.php
Access the file through your web browser by navigating to http://your-server-ip/info.php
. You should see a page displaying PHP configuration information. This confirms that Apache is correctly processing PHP files.
Step 5: Install and Configure MySQL/MariaDB
PHPList requires a database to store its data. We’ll install MariaDB, a MySQL-compatible database server:
# Install MariaDB server
sudo dnf install mariadb-server -y
# Start and enable MariaDB service
sudo systemctl start mariadb
sudo systemctl enable mariadb
Secure the MariaDB installation:
# Run MariaDB secure installation script
sudo mysql_secure_installation
During the secure installation process:
- Press Enter for the current password (none by default for a new installation)
- Type “Y” to set a root password and enter your chosen password
- Answer “Y” to all remaining questions to remove anonymous users, disallow remote root login, remove test database, and reload privileges
This strengthens your database security by removing potential vulnerabilities.
Step 6: Create PHPList Database and User
Now we’ll create a dedicated database and user for PHPList:
# Log in to MariaDB as root
sudo mysql -u root -p
Enter the root password you set in the previous step. Then run the following SQL commands:
# Create PHPList database
CREATE DATABASE phplistdb;
# Create PHPList user with a secure password
CREATE USER 'phplistuser'@'localhost' IDENTIFIED BY 'your_secure_password';
# Grant privileges to the PHPList user
GRANT ALL PRIVILEGES ON phplistdb.* TO 'phplistuser'@'localhost';
# Apply the changes
FLUSH PRIVILEGES;
# Exit MariaDB
EXIT;
Make sure to replace ‘your_secure_password’ with a strong password. This database will store all PHPList data, including subscriber information, campaigns, and analytics.
Step 7: Download and Extract PHPList
Now let’s download the latest version of PHPList:
# Navigate to temporary directory
cd /tmp
# Download PHPList using wget
wget https://sourceforge.net/projects/phplist/files/phplist/3.6.13/phplist-3.6.13.zip
# Install unzip if not already installed
sudo dnf install unzip -y
# Extract the downloaded archive
unzip phplist-3.6.13.zip
The extraction creates a directory named “phplist-3.6.13” containing all PHPList files. The version number may differ depending on the latest release available.
Step 8: Upload and Configure PHPList Files
Move the PHPList files to the web server directory:
# Create a directory for PHPList
sudo mkdir -p /var/www/html/list
# Copy PHPList files to the web directory
sudo cp -r phplist-3.6.13/public_html/* /var/www/html/list/
# Set appropriate ownership and permissions
sudo chown -R apache:apache /var/www/html/list
sudo chmod -R 755 /var/www/html/list
Next, configure PHPList by editing the config.php file:
# Navigate to the config directory
cd /var/www/html/list/config
# Make a backup of the original config file
sudo cp config_extended.php config.php
Edit the config.php file to add your database connection details:
# Edit the configuration file
sudo nano config.php
Find and update the following settings:
// Database connection details
$database_host = 'localhost';
$database_name = 'phplistdb';
$database_user = 'phplistuser';
$database_password = 'your_secure_password';
// Base URL settings
$pageroot = '/list';
$adminpages = '/list/admin';
// Set test mode to 0 to enable actual email sending
define('TEST', 0);
Save and close the file. These settings connect PHPList to the database and configure basic system parameters.
Step 9: Complete Web-based Installation
Access the PHPList web installer by navigating to http://your-server-ip/list/admin/
in your browser. You should see the PHPList setup page.
Follow these steps to complete the installation:
- Click on “Initialise database” to create the necessary database tables
- Once the database is initialized, click on “PHPList setup” at the bottom of the page
- Log in with the default credentials (username: admin, password: phplist)
- After logging in, go to “Admin” → “Admin Details” to change the default password
- Enter a new password and update your admin information
If prompted, subscribe to the PHPList announcements or skip this step according to your preference. The web-based installation completes the setup process by creating all necessary database tables and initial configurations.
Step 10: Secure Your PHPList Installation
Security is crucial for your PHPList installation, especially since it handles sensitive subscriber data. Implement these security measures:
Enable HTTPS with Let’s Encrypt
# Install Certbot and Apache plugin
sudo dnf install certbot python3-certbot-apache -y
# Obtain and install SSL certificate
sudo certbot --apache -d yourdomain.com
Replace “yourdomain.com” with your actual domain name.
Secure the Admin Directory
Create an .htaccess file to add an extra layer of protection:
# Create .htaccess file
sudo nano /var/www/html/list/admin/.htaccess
Add the following content:
# Deny access from specific IP ranges
Order Allow,Deny
Allow from all
Deny from 192.168.0.
# Set additional security headers
<IfModule mod_headers.c>
Header set X-Content-Type-Options nosniff
Header set X-Frame-Options SAMEORIGIN
Header set X-XSS-Protection "1; mode=block"
</IfModule>
Set Proper File Permissions
# Set restrictive permissions on configuration files
sudo chmod 400 /var/www/html/list/config/config.php
These security measures help protect your PHPList installation from common web attacks and unauthorized access.
Step 11: Configure Email Delivery
Configure email delivery settings to ensure reliable message delivery:
- Log in to the PHPList admin dashboard
- Navigate to “Config” → “Settings”
- Find the “Sending Settings” section
- Configure SMTP settings:
- SMTP host: your-smtp-server.com
- SMTP port: 587 (or appropriate for your provider)
- SMTP username and password
- Enable TLS encryption
For optimal email delivery, configure batch sending parameters:
# Edit the configuration file
sudo nano /var/www/html/list/config/config.php
Add or update the following settings:
// Email batch settings
define("MAILQUEUE_BATCH_SIZE", 150);
define("MAILQUEUE_BATCH_PERIOD", 3600);
define("MAILQUEUE_AUTOTHROTTLE", 1);
This configuration sends 150 emails per hour, which helps avoid hitting provider limits and improves deliverability rates.
Optimizing PHPList Performance
To ensure optimal performance, especially with large subscriber lists, implement these optimizations:
PHP Optimization Settings
Edit the PHP configuration file:
# Edit php.ini
sudo nano /etc/php.ini
Update these settings:
memory_limit = 256M
max_execution_time = 300
upload_max_filesize = 20M
post_max_size = 20M
Database Optimization
Run MySQL optimization routines periodically:
# Log in to MariaDB
sudo mysql -u root -p
# Run optimization queries
OPTIMIZE TABLE phplistdb.phplist_user_user;
OPTIMIZE TABLE phplistdb.phplist_message;
Implement Caching
Configure PHP OPcache for better performance:
# Edit OPcache configuration
sudo nano /etc/php.d/10-opcache.ini
Update these settings:
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
These optimizations help PHPList handle larger subscriber bases and send campaigns more efficiently.
Troubleshooting Common Issues
Database Connection Problems
If you encounter database connection issues:
- Verify database credentials in config.php
- Check if the MySQL service is running:
sudo systemctl status mariadb
- Test database connectivity:
mysql -u phplistuser -p -h localhost phplistdb
Email Sending Issues
If emails are not being sent:
- Check if TEST mode is disabled (set to 0) in config.php
- Verify SMTP settings in the admin dashboard
- Check server logs for email errors:
sudo tail -f /var/log/maillog
- Test email functionality from command line:
echo "Test email" | mail -s "Testing mail" your-email@example.com
Permission Problems
For permission-related issues:
- Ensure correct ownership of PHPList files:
sudo chown -R apache:apache /var/www/html/list
- Check Apache error logs for permission issues:
sudo tail -f /var/log/httpd/error_log
These troubleshooting steps address the most common issues encountered when setting up PHPList.
Congratulations! You have successfully installed PHPList. Thanks for using this tutorial for installing PHPList on the Rocky Linux 9 system. For additional help or useful information, we recommend you check the official PHPList website.