php-fpm - ERROR: Unable to create the PID file (/var/run/php-fpm.pid).: Permission denied (13)
This document (000020762) is provided subject to the disclaimer at the end of this document.
Environment
Situation
In SLES 15 SP4, when the /etc/php7/fpm/php-fpm.conf config file is assigned a pid file, for example "pid = run/php-fpm.pid", the service may fail to start with the following output:
ERROR: Unable to create the PID file (/var/run/php-fpm.pid).: Permission denied (13) ERROR: FPM initialization failed systemd[1]: php-fpm.service: Main process exited, code=exited, status=78/CONFIG
Resolution
- Disable apparmor
- Disable the php-fpm profile
- Make appropriate modification to the php-fpm profile configuration.
Disabling apparmor
To stop and disable the apparmor service altogether, and unload the profiles without rebooting, you could run the following:# aa-status # aa-teardown # aa-status # systemctl disable --now apparmor.service # aa-status
Disabling apparmor profiles
To disable just the php-fpm profile, but keep the other profiles loaded run:
# aa-status # aa-disable php-fpm # aa-status
You'll notice the php-fpm profile is removed from the status output.
Make appropriate modification to the php-fpm profile configuration
Modify the profile configuration file, to fit your needs. For example: vim /etc/apparmor.d/php-fpm
You'll see a comment line "# we need to be able to create all sockets". Below the line, add the following line:
@{run}/php{,-fpm}/php*-fpm.pid rw,
Save, and then reload the service, and rescan the profile, by running:
# systemctl reload apparmor.service
Cause
Status
Additional Information
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:000020762
- Creation Date: 13-Sep-2022
- Modified Date:10-Nov-2022
-
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com