Cannot start php-fpm on directadminCannot start php-fpm on directadmin

Cannot start PHP FPM service: cannot get uid for user

Cannot start PHP FPM service:

systemctl status php5-fpm.service
...
ERROR: [pool example.com] cannot get uid for user 'john.doe'
ERROR: FPM initialization failed
php5-fpm.service: main process exited, code=exited, status=78/n/a
Failed to start The PHP FastCGI Process Manager.
Unit php5-fpm.service entered failed state.

In php.fpm.d configuration file for the domain the name is equal with the name from the error:

grep user /etc/php-fpm.d/example.com
user = john.doe


egrep -R user /opt/plesk/php/*/etc/php-fpm.d/example.com.conf
/opt/plesk/php/7.2/etc/php-fpm.d/example.com.conf:user = john.doe

In Plesk database, system user differs from PHP FPM pool username:

  • plesk db “select s.login from sys_users s join hosting h on h.sys_user_id=s.id join domains d on d.id=h.dom_id where d.name=’example.com'”
    +———–+
    | login |
    +———–+
    | example |
    +———–+

Cause

The required system user is missing. php-fpm pool wasn’t updated properly.

Resolution

  1. Log in to Plesk
  2. Re-generate PHP settings for the domain mentioned in the error message going to Domains > example.com > PHP Settings > OK Note: if the domain has “No hosting” type, change the domain’s hosting type to “Website” and specify username from the error.

To update PHP settings of all the domains:

  1. Connect to the server using SSH
  2. Apply changes to php_settings with the following command:

/usr/local/psa/bin/php_settings -u
Per-domain PHP settings of all domains were successfully updated.

By admin