yevgenko / cookbook-php-fpm

Installs/Configures php-fpm
http://community.opscode.com/cookbooks/php-fpm
Apache License 2.0
68 stars 117 forks source link

Wrong includes directory in php_fpm.conf after vagrant install #26

Open eethann opened 10 years ago

eethann commented 10 years ago

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.

yevgenko commented 10 years ago

which vm box you've used?

n1koo commented 10 years ago

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

spinx commented 10 years ago

@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"

n1koo commented 10 years ago

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.

spinx commented 10 years ago

@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

n1koo commented 10 years ago

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.

eethann commented 10 years ago

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.

glensc commented 10 years ago

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

ameir commented 10 years ago

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.

glensc commented 10 years ago

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

luxin88 commented 9 years ago

mabye selinux, execute "setenforce 0" and try again

dagelf commented 7 years ago

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