When PHP-FPM fails to start with the error "unable to set listen address as it's already used in another pool," it means two or more pool configurations are trying to listen on the same socket path or TCP port. PHP-FPM cannot bind the same address twice, so the second pool fails and PHP-FPM either refuses to start entirely or starts with only the first pool active.
Understanding the Error
The full error message typically looks like:
[ERROR] FPM initialization failed
[ERROR] [pool site2] unable to set listen address as it's already used in another pool 'site1'
Or in the systemd journal:
php-fpm8.2[1234]: [ERROR] [pool site2] unable to set listen address as it's already used in another pool 'www'
This tells you that the pool named site2 has the same listen directive as the pool named site1 (or www). Each pool must have a unique listen address.
Finding Conflicting Pool Configurations
Pool configuration files are stored in the pool.d directory:
# List all pool configuration files:
ls -la /etc/php/8.2/fpm/pool.d/
# Common output:
# www.conf (default pool)
# site1.conf (custom pool)
# site2.conf (custom pool)
# Search for listen directives across all pool files:
grep -n "^listen" /etc/php/8.2/fpm/pool.d/*.conf
# Example output showing the conflict:
# /etc/php/8.2/fpm/pool.d/www.conf:36:listen = /run/php/php8.2-fpm.sock
# /etc/php/8.2/fpm/pool.d/site1.conf:5:listen = /run/php/php8.2-fpm.sock
# /etc/php/8.2/fpm/pool.d/site2.conf:5:listen = /run/php/php8.2-fpm.sock
In this example, all three pools are using the same socket path. Each must use a unique path.
Fixing the Conflict: Unique Socket Paths
The recommended approach is to give each pool its own Unix socket:
# /etc/php/8.2/fpm/pool.d/www.conf
[www]
listen = /run/php/php8.2-fpm.sock
# /etc/php/8.2/fpm/pool.d/site1.conf
[site1]
listen = /run/php/php8.2-fpm-site1.sock
# /etc/php/8.2/fpm/pool.d/site2.conf
[site2]
listen = /run/php/php8.2-fpm-site2.sock
Each socket path must be unique. A common naming convention is to include the pool name or site name in the socket filename.
Alternative: Using TCP Ports
Instead of Unix sockets, you can use TCP ports. This is less common for local connections but necessary when PHP-FPM runs on a different server than the web server:
# /etc/php/8.2/fpm/pool.d/www.conf
[www]
listen = 127.0.0.1:9000
# /etc/php/8.2/fpm/pool.d/site1.conf
[site1]
listen = 127.0.0.1:9001
# /etc/php/8.2/fpm/pool.d/site2.conf
[site2]
listen = 127.0.0.1:9002
Each pool gets a different port number. Verify no other service is using the chosen ports:
# Check which ports are in use:
ss -tlnp | grep -E '900[0-9]'
Removing the Default www.conf
A very common cause of this error is the default www.conf file conflicting with a custom pool. When you create custom pool configurations, the default pool is often unnecessary:
# Option 1: Remove the default pool
sudo rm /etc/php/8.2/fpm/pool.d/www.conf
# Option 2: Rename it to disable (safer — you can restore it later)
sudo mv /etc/php/8.2/fpm/pool.d/www.conf /etc/php/8.2/fpm/pool.d/www.conf.disabled
# Option 3: Change its listen address to something unique
# Edit www.conf and set a unique socket path
PHP-FPM loads all .conf files in the pool.d directory. Renaming the file to .conf.disabled prevents it from being loaded.
Complete Pool Configuration Example
Here is a complete pool configuration for a WordPress site with a unique socket:
[wordpress-site1]
; Process user/group
user = site1user
group = site1user
; Unique socket path
listen = /run/php/php8.2-fpm-site1.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
; Process management
pm = dynamic
pm.max_children = 15
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 5
pm.max_requests = 500
; Logging
access.log = /var/log/php-fpm/site1-access.log
slowlog = /var/log/php-fpm/site1-slow.log
request_slowlog_timeout = 10s
; Security
php_admin_value[open_basedir] = /var/www/site1/:/tmp/:/usr/share/php/
php_admin_value[upload_tmp_dir] = /var/www/site1/tmp/
php_admin_value[session.save_path] = /var/www/site1/sessions/
Updating Web Server Configuration
After changing the socket path, update your web server to use the new socket:
Nginx
server {
server_name site1.example.com;
root /var/www/site1;
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.2-fpm-site1.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Apache (mod_proxy_fcgi)
<VirtualHost *:80>
ServerName site1.example.com
DocumentRoot /var/www/site1
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.2-fpm-site1.sock|fcgi://localhost"
</FilesMatch>
</VirtualHost>
Restarting and Verifying
# Test the PHP-FPM configuration:
sudo php-fpm8.2 -t
# Output: NOTICE: configuration file /etc/php/8.2/fpm/php-fpm.conf test is successful
# Restart PHP-FPM:
sudo systemctl restart php8.2-fpm
# Verify all pools are running:
sudo systemctl status php8.2-fpm
# Check the sockets exist:
ls -la /run/php/php8.2-fpm*.sock
# Check with ss:
ss -xlnp | grep php
Troubleshooting After the Fix
- 502 Bad Gateway after changing the socket: The web server is still pointing to the old socket path. Update your Nginx/Apache configuration to match the new socket path and reload.
- Permission denied on socket: Ensure
listen.ownerandlisten.groupmatch the user your web server runs as (usuallywww-data). - Socket file not created: Check if the
/run/php/directory exists. It may be a tmpfs mount that gets cleared on reboot. PHP-FPM usually creates it via a systemd tmpfiles configuration. - Error persists after removing www.conf: Make sure you restarted PHP-FPM, not just reloaded it. Configuration file additions/removals require a restart.
For more on PHP-FPM pool configuration in the context of WordPress, see PHP-FPM Pool Setup — WordPress FTP/SFTP Prompt Fix.