sous-chefs/php

PHP-FPM - separate install and configuration

Closed this issue · 8 comments

ameir commented

I think that modularizing the FPM portions a bit would make supporting PHP7 or alternate repos much easier. Instead of the php-fpm install being taken care of in the provider, I think it'd be better to just do include_recipe 'php::fpm' if users want the default package, else they can install from Remi or a PPA or whatever, and use the LWRP to manage the FPM pools.

In my specific case, I'd like to install PHP (either 5.6 or 7, depending on the project) from the Remi repos (CentOS 7). This repo isn't enabled by default in yum, so I need to pass --enablerepo=remi* to the package resource options. This isn't exposed in the LWRP, and it doesn't really matter if it is if the separation is there. If you are against separation, then allowing the passing in of yum options would be great.

@ameir do you have sample of the code that you are referring to? I am also looking into this and I think the best thing would be to define the yum repos outside of the cookbook for now.

I am working on the option to install php-mcrypt on rhel systems which requires the remi repositories to be configured as well, I am just waiting on feedback from the maintainers as how they would like to see this implemented. @tas50 @jtimberman @someara

ameir commented

@Sauraus, I am currently using the Remi repo cookbook that @iennae linked above, along with https://github.com/yevgenko/cookbook-php-fpm. I only run 'php-fpm::install' from that cookbook, and install any other packages I need outside of that (using the package resource). I mainly use that cookbook for its definitions to manage FPM pools.

Looking at this cookbook again, it looks like my issue's been worked on already; I see default['php']['package_options'] at https://github.com/chef-cookbooks/php/blob/a836cb5f3a2d1fce62334e42fb6e64169ed1e5a1/attributes/default.rb#L157 and its usage at https://github.com/chef-cookbooks/php/blob/a836cb5f3a2d1fce62334e42fb6e64169ed1e5a1/recipes/package.rb#L61 .

In short, you should be able to include the remi repos, and do something like default['php']['package_options'] = '--enablerepo=remi*' before running the package recipe. I don't think it's necessary to depend on the yum-remi-chef cookbook in this cookbook.
I hope that helps.

@ameir Thanks so much for the update. Appreciate you contributing all the info on how you resolved your issue!

Ok I will give this a go.

Worked like a charm :) this is what is needed in a recipe to get a custom PHP build installed.

node.default['php']['package_options'] = '--enablerepo=remi* --enablerepo=remi-php70'

include_recipe 'yum-remi-chef::remi'
include_recipe 'yum-remi-chef::remi-php70'

Closing due to inactivity.

If this is still an issue please reopen or open another issue. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help!

Thanks,
Sous-Chefs

lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.