sous-chefs/php

Installing from source doesn't support upgrading version

Closed this issue · 5 comments

Cookbook version

1.9.0 / master

Chef-client version

N/A

Platform Details

N/A

Scenario:

After installing one version of php from source,
updating the version attribute and
running chef again I'd expect the recipe to update the version.

Steps to Reproduce:

Set:
default['php']['install_method'] = 'source'
default['php']['version'] = '5.6.13'

Run chef.

Update attribute in anyway you wish:
default['php']['version'] = '5.6.14'

(default['php']['checksum'] should be updated, but won't matter in current state.)

Run chef again.

Check:
php --version

Expected Result:

5.6.14

Actual Result:

5.6.13

Suggested change:

Lines:
https://github.com/chef-cookbooks/php/blob/master/recipes/source.rb#L42
https://github.com/chef-cookbooks/php/blob/master/recipes/source.rb#L71
Should probably be changed from checking if a php version is installed to
if the version installed is inline with set version in the attribute.
(I understand this upgrade might cause issues for running app if user is not aware of what he's doing)

So from:
not_if "which #{node['php']['bin']}"

To something like:
not_if "which #{node['php']['bin']} --version | grep %s" % node['php']['version']
Or
not_if "which #{node['php']['bin']} --version | grep %s" % version
(using the version pre-set var in https://github.com/chef-cookbooks/php/blob/master/recipes/source.rb#L36)

Silly question here, where do you find the checksum for the PHP version (I tried using the md5 in the release pages but that didn't work)

On Mac

curl -Ls http://us1.php.net/get/php-{PHP-VERSION}.tar.gz/from/this/mirror | shasum -a 256 - | awk '{ print $1 }'

@chris-fa sha256 sums are on downloads page http://php.net/downloads.php

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.