cookbook-php-fpm icon indicating copy to clipboard operation
cookbook-php-fpm copied to clipboard

Wrong includes directory in php_fpm.conf after vagrant install

Open eethann opened this issue 10 years ago • 12 comments

I have installed php-fpm via chef in vagrant using just "add_recipe 'php-fpm'". The basic install seems to work but the system fails when starting up the service. The error given is:

Starting php-fpm: [06-Dec-2013 07:40:51] ERROR: Unable to globalize '/etc/php-fpm.d/pools/*.conf' (ret=2) from /etc/php-fpm.conf at line 11.
[06-Dec-2013 07:40:51] ERROR: failed to load configuration file '/etc/php-fpm.conf'
[06-Dec-2013 07:40:51] ERROR: FPM initialization failed

I saw that the path of the include directive in php-fpm.conf is wrong, it is currently pointing to /etc/php-fpm.d/pools/*.conf but there is no pools directory inside /etc/php-fpm.d/. Changing the include path in the conf file to remote "/pools" allows the service to be started.

eethann avatar Dec 06 '13 07:12 eethann

which vm box you've used?

yevgenko avatar Dec 06 '13 10:12 yevgenko

Same issue here. CentOS6.4, custom build minimal installation but only Chef installed on top of it. Using Epel -repos if that matters.

n1koo avatar Dec 07 '13 15:12 n1koo

@eethann @n1koo Just including the recipe won't install proper configs. Create another recipe for creating the pool: include_recipe 'php-fpm' php_fpm_pool "www"

spinx avatar Dec 08 '13 00:12 spinx

Yeah, noticed that. I don't know why the service is started in the default recipe. Since at that point it shouldn't actually have any pools. I'm just about to start changing the default action to :nothing. After creating the pool the service is restarted anyways, so that should work.

n1koo avatar Dec 08 '13 08:12 n1koo

@n1koo I've foked this and added pool creation in the default recipe. You can configure it as well. https://github.com/spinx/cookbook-php-fpm

Pull request: https://github.com/yevgenko/cookbook-php-fpm/pull/27

spinx avatar Dec 08 '13 09:12 spinx

Looks nice, but doesn't the fpm process still get started before creating the pools? I'm the process of testing out zabbix, and this how they use it ( https://github.com/laradji/zabbix/blob/master/recipes/web_nginx.rb ).

Afaik, this should be totally legal. No usage of the default www-pool, start php-fpm after that custom pool has been added.

n1koo avatar Dec 08 '13 10:12 n1koo

I'm also on CentOS 6.4, provisioning with chef-solo. Spinx's pull request #27 looks like exactly what I'd need. Will test.

eethann avatar Dec 10 '13 04:12 eethann

i also got hit this problem that php-fpm is attempted to start before config from lrwp is written down, and thefore whole recipe fails because service php-fpm is not started.

for me the error was:

[12-Dec-2013 14:41:03] WARNING: Nothing matches the include pattern '/etc/php/fpm.d/*.conf' from /etc/php/php-fpm.conf at line 16.
[12-Dec-2013 14:41:03] ERROR: No pool defined. at least one pool section must be specified in config file
[12-Dec-2013 14:41:03] ERROR: failed to post process the configuration
[12-Dec-2013 14:41:03] ERROR: FPM initialization failed

i think the simpliest is action :nothing in recipes/default.rb and rely on notification to start it

glensc avatar Dec 12 '13 12:12 glensc

Sorry guys, that was my doing. I think that enabling (but not starting) PHP-FPM is ideal, and that a (delayed) notification starts/restarts it when a pool is added. I don't know about adding a default pool since most folks would probably want to 'enable false' it and add their own. The 'standard' with cookbooks in general seems to go against auto-adding things you later remove.

ameir avatar Dec 12 '13 17:12 ameir

ameir: not following what you are saying with your last commit, you mean PR #29 is ok you to be merged?

glensc avatar Dec 13 '13 12:12 glensc

mabye selinux, execute "setenforce 0" and try again

luxin88 avatar Jul 17 '15 03:07 luxin88

Not sure if this is relevant for you guys, but I've run into this error a lot and there's no good info anywhere else, so here's a better tip than "setenforce 0" if you're on Ubuntu:

sudo aa-complain /usr/local/bin/php-fpm
/usr/local/bin/php-fpm

dagelf avatar Feb 21 '17 15:02 dagelf