Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP7 Support #162

Closed
chriswgerber opened this issue Jan 22, 2016 · 25 comments
Closed

PHP7 Support #162

chriswgerber opened this issue Jan 22, 2016 · 25 comments

Comments

@chriswgerber
Copy link
Contributor

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.

@matthieumota
Copy link
Contributor

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 👍

@sebfek
Copy link

sebfek commented Feb 8, 2016

+1 :)

@thomask
Copy link

thomask commented Feb 25, 2016

👍

@tas50
Copy link
Contributor

tas50 commented Feb 25, 2016

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.

@chriswgerber
Copy link
Contributor Author

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.

@jekriske-lilly
Copy link

👍 to PHP7, it's significantly faster. Looking forward to the refactor.

@sergiuionescu
Copy link

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

@chriswgerber
Copy link
Contributor Author

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.

@chriswgerber
Copy link
Contributor Author

#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.

@chriswgerber
Copy link
Contributor Author

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.

@aight8
Copy link

aight8 commented Apr 14, 2016

Is there any status update for the PR?

@tas50
Copy link
Contributor

tas50 commented Apr 14, 2016

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.

@danbuchal
Copy link

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

@chriswgerber
Copy link
Contributor Author

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
Copy link
Contributor

tas50 commented May 1, 2016

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
Copy link

ameir commented May 4, 2016

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.

@chriswgerber
Copy link
Contributor Author

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

@chriswgerber
Copy link
Contributor Author

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

@tas50 tas50 closed this as completed May 12, 2016
@tas50
Copy link
Contributor

tas50 commented May 12, 2016

Merged and about to ship

@danbuchal
Copy link

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

@chriswgerber
Copy link
Contributor Author

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

@danbuchal
Copy link

danbuchal commented May 16, 2016

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.

@chriswgerber
Copy link
Contributor Author

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.

@danbuchal
Copy link

@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
Copy link

lock bot commented Apr 25, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants