debops / ansible-php

Install and manage PHP environment with php-fpm
GNU General Public License v3.0
6 stars 10 forks source link

Can't create pid file for php7.0-fpm, because `php__run_base` directory hasn't been created. #24

Open beata opened 7 years ago

beata commented 7 years ago

For PHP7 and above, the pid file would be placed in /run/php, which hasn't been created on filesystem. Thus NGINX can't work with PHP-FPM.

templates/etc/php/fpm/php-fpm.conf.j2
20:pid = {{ php__run_base }}/php{{ php__version }}-fpm.pid

env/tasks/main.yml
76:    php__run_base: '{{ "/run/php"
77-                       if (php__version | version_compare("7.0", ">="))
78-                       else "/run" }}'
drybjed commented 7 years ago

What OS distribution and release do you use? Do you use PHP7 from Sury repositories? It might be an issue with the PHP7 package not adding the required directory entry in /run/.

beata commented 7 years ago

Here's my environment variables:

Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty

# Custom variables
php__sury: True
php__packages: [ 'mysql', 'xml', 'mbstring', 'zip' ]
php__production: True
php__ini_cgi_fix_pathinfo: False # nginx should have the option disabled
php__ini_post_max_size: 16M
php__fpm_listen_owner: www-data
php__fpm_listen_group: www-data
php__fpm_pm: dynamic
drybjed commented 7 years ago

The /run/php/ directory is created on systemd-based hosts by the /usr/lib/tmpfiles.d/php7.0-fpm.conf file. This requires a systemd init to work. I'm not sure how that was done under sysvinit hosts, probably via the init script itself. Still, that should be solved by the package maintainer. Perhaps it's time to consider an upgrade, at least to latest Ubuntu 16.04 LTS release? It should work fine there.