Symptoms
The apache_php_fpm service fails to start, with an error similar to:
CONFIG_TEXT: [12-Aug-2022 09:47:51] ERROR: FPM initialization failed
[12-Aug-2022 09:49:59] ERROR: [pool domain_tld] the chdir path '/home/username' does not exist or is not a directory
Cause
The apache_php_fpm service will fail to start if an account was removed from the server, but its PHP-FPM configuration file(s) was left behind, or if an existing cPanel user's configured home directory is missing.
Resolution
- Log in to the server via SSH or WHM's Terminal as the
rootuser Try to start the Apache PHP-FPM service to see what errors are experienced:
# /scripts/restartsrv_apache-php_fpm --start
Note: You will want to note the missing home directory, PHP version(s) that PHP-FPM is unable to start for, and the domain(s) in the errors.
See if the cPanel user that's missing its home directory exists on the server:
# /scripts/whoowns username
Note: You need to replace
usernamewith the cPanel username.
For example, in the error:
[12-Aug-2022 09:49:59] ERROR: [pool domain_tld] the chdir path '/home/cptest' does not exist or is not a directory
The cPanel username iscptest.- Follow the instructions in one of the provided tabs, depending on whether the cPanel user exists on the server or not.
The following command will scan through the accounting logs for accounts that have been removed, and use that to search for leftover cruft in the ea-php and alt-php configuration directories:
# for u in $(awk -F: '/:REMOVE:/{print $NF}' /var/cpanel/accounting.log | sort -u); do grep -rEH "^chdir = /home[0-9]/$u/?$" /opt/alt/php-fpm/usr/etc/php-fpm.d /opt/cpanel/ea-php*/root/etc/php-fpm.d 2>/dev/null; done
For any positive results from the above command, move aside the problematic PHP-FPM cruft:
# mv -v /opt/cpanel/ea-php##/root/etc/php-fpm.d/domain.tld.conf{,.backup.$(date +%F_%R)}
Note: You need to replace
ea-php##with the ea-php or alt-php version that is failing to start anddomain.tld.confwith the domain. This may need to be done for multiple domains.Start the Apache PHP-FPM service:
# /scripts/restartsrv_apache_php_fpm --start
Create the missing home directory:
# mkdir -v /home/username; chown username.username /home/username; chmod 0711 /home/username
Note: You need to replace all instances of
usernamein the above-provided command with the cPanel username.Start the Apache PHP-FPM service:
# /scripts/restartsrv_apache_php_fpm --start
Comments
0 comments
Article is closed for comments.