sous-chefs/php

PHP7 Support

Closed this issue Β· 25 comments

I haven't seen any threads about this so I thought I would ask the question: Is any work being done to prepare for PHP7? I would like to try and piggy-back on work already being done before starting it myself.

There's a few spots here and there (e.g. https://github.com/chef-cookbooks/php/blob/master/providers/pear.rb#L174) that need to be fixed to support PHP7, but for the most part it seems to be just changes to attributes and packages.

I think you can easily use PHP7 with override attributes and packages but beware if you use fpm. There are many attributes to this to change and maybe the provider need to be update. I wish PHP7 from this cookbook too πŸ‘

+1 :)

πŸ‘

tas50 commented

At the moment there isn't work being done to prep for PHP7. Why you might ask? Well we're a fairly small team working on a several year backlog of work. At the moment we're doing work on the Tomcat, etcd, and docker cookbooks. I personally expect to be hitting PHP soon and I plan to evaluate a large scale refactor that would do away with the mess of attributes we have right now and would also include support for additional PHP versions.

Thanks @tas50 for the update. I hope I didn't come off demanding with my question, I just didn't want to get started on a PR for php7 support and find out some work had already been started on another branch.

πŸ‘ to PHP7, it's significantly faster. Looking forward to the refactor.

The cookbook can currently be used to install php7 using custom package repositories and a minor patch.
Here is how i manage to set it up for ubuntu 14.04:

In your custom recipe setup the ppa before including the php cookbook:

apt_repository 'ondrej-php' do
  uri          'ppa:ondrej/php'
  distribution node['lsb']['codename']
  only_if { node['php']['version'] >= '7' }
end
...
include_recipe 'php'
  1. Override the following default attributes:
"override_attributes": {
        "php": {
            "version": "7.0",
            "conf_dir": "/etc/php/7.0/cli",
            "packages": [
                "php7.0-cgi",
                "php7.0",
                "php7.0-dev",
                "php7.0-cli",
                "php7.0-json",
                "php7.0-curl",
                "php-pear"
            ],
            "mysql": {
                "package": "php7.0-mysql"
            },
            "fpm_package": "php7.0-fpm",
            "fpm_pooldir": "/etc/php/7.0/fpm/pool.d",
            "fpm_service": "php7.0-fpm",
            "fpm_default_conf": "/etc/php/7.0/fpm/pool.d/www.conf"
        }
    }

If you wish to give it a spin, you can find the full setup here:
https://github.com/sergiuionescu/lamp

I'm more referring to the LWRP.

php_pear "XML_RPC" do
  version "1.5.4"
  action :install
end

Will run /usr/sbin/php5enmod XML_RPC instead of phpenmod XML_RPC, adding it as a php5 module instead of php7. A problem that can be easily solved when I have time to create the pull request, but also other cases like that might need to be taken into account.

#169

I've created a PR that will bring support for Ubuntu 16.04 (which will default to PHP7) and allow for PHP7 to be supported on Ubuntu 14.04, as well.

Any movement on this? We're working to get our environments prepared for Ubuntu 16.04 and PHP7 support is a step in the process.

Is there any status update for the PR?

tas50 commented

PHP7 support is going to require us to start testing on 16.04, and we currently lack GM docker boxes for Travis CI testing and GM bento boxes for testing locally. Once the final 16.04 release comes out and we have a testing infrastructure in place we'll move forward with PHP7 support.

@tas50 is there any possibility of parameterizing just the enable_mod and disable_mod that @ThatGerber submitted? With that change alone I was able to install PHP7 by overriding the other parameters as needed. This would not need to install PHP7 by default or even "officially" claim support of PHP7, but would allow those adventurous enough to be able to do it.

I would be open to adjusting the commits or splitting it into multiple PRs while we wait for official boxes. I have no desire to maintain my own fork of the PHP cookbook so I'd like to get some of these changes merged back if they feel it's a fit for the cookbook.

tas50 commented

Ubuntu 16.04 boxes are out so we can test this and get it out. I've added 16.04 testing to this repo, which is why it's currently failing. I'll see what I can do tomorrow.

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.

@tas50 I written fixes for the PR that I will push once sous-chefs/mysql#421 is merged. There is a bug in that repository that is causing "source-install-ubuntu-1604" install to fail dealing with the mysql client install.

I rebased the php7/16.04 branch on top current changes and pushed up the latest fixes for Ubuntu. Builds are passing now.

tas50 commented

Merged and about to ship

Out of curiosity, why are the default values changed to install PHP 7 only for Ubuntu 16.04?

@danbuchal There are multiple reasons to leave it be.

  1. There is no Debian/Ubuntu maintained package for PHP7 on 14.04. Any choice as for a package to install would come from a PPA or a build from source, and it's hard to support that as the default setting.
  2. PHP5 has been the default install on 14.04 for 2 years. It would be in slightly bad taste to change the default from PHP5 to PHP7 and break with the system default for all users. It's best to allow people to opt-in deliberately to changes like that when it could break backwards compatibility, rather than default to assuming that people will approve.

That was my reasoning when writing the pull request. If you'd like to try getting PHP7 installed on 14.04, you could try installing a PHP PPA OndΕ™ej SurΓ½'s PPA is spoken of highly and overwriting the default PHP packages before running the recipe. You might need to make additional changes to the PHP attributes, however, but the ability to get php7 installed and running should be there.

My intention with the question wasn't about earlier versions of Ubuntu necessarily... but other distributions altogether. RHEL, etc. It seems this cookbook now has different default functionality based on what distribution you are using. I can easily enough override those for say a CentOS install, but I wanted to point out this discrepancy. Maybe part of these solution is to spell out those differences (if they are intentional) in the readme.

I guess the reasoning then is the maintainers didn't have the time to work together a PR for the functionality and I did so I contributed what I could. The main push for PHP7 on my end was to support 16.04, within which the default PHP version (apt-get install php) installs PHP7. In order to support 16.04, the repository also needed to support PHP7. There was no intent to make the cookbook functionally different, but because distributions and versions are different, they are functionally different by necessity.

@ThatGerber I understand, and believe me I thank you for moving on this since now I can officially kill the fork I was having to maintain to make this work. This is just a suggestion for the official maintainers.

Thanks again!

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.