puppet-php icon indicating copy to clipboard operation
puppet-php copied to clipboard

php cli defaults to 7.0 update-alternatives

Open star3am opened this issue 9 years ago • 6 comments

Hi there, I had a problem where even if I set: php::globals::php_version: '5.6'

php cli would still be version 7 on ubuntu.

after troubleshooting I found that php-cli 7.0 has a higher priority in update-alternatives than php-cli 5.6 i solved it like this, but thought I'd just give you a heads-up

`$php_minversion = hiera('php::globals::php_version')

class { '::php': }

set the PHP CLI to php::globals::php_version

exec { "update-alternatives-php${php_minversion}": command => "/usr/bin/update-alternatives --quiet --install /usr/bin/php php /usr/bin/php${php_minversion} 100 && /usr/bin/update-alternatives --auto php", unless => "/bin/ls -l /etc/alternatives/php | /bin/grep ${php_minversion}", require => Class['::php'], }`

star3am avatar Aug 24 '16 12:08 star3am

I'd rather use the puppet-alternatives module and it would also be needed to check if that alternative needs to get set for all versions of Debian/Ubuntu or not.

mmoll avatar Aug 24 '16 14:08 mmoll

@mmoll yea, that would be better, thanks - but still maybe an issue for others and should be done in this module.

star3am avatar Aug 24 '16 15:08 star3am

@star3am sure thing... could you open a pull request with that? :)

mmoll avatar Aug 24 '16 16:08 mmoll

Should be in README, not a code change

juniorsysadmin avatar Dec 25 '16 06:12 juniorsysadmin

There is also this similar issue with Ubuntu ppa from Ondrej: https://github.com/oerdnj/deb.sury.org/issues/563

I've created a PR that allow to provide the --no-install-recommends option when installing php-apcu : https://github.com/voxpupuli/puppet-php/pull/319 https://github.com/voxpupuli/puppet-php/pull/318

With that option and using the correct dependencies when installing php extensions, the /usr/bin/update-alternatives workaround is not required any more.

Vincent-- avatar Mar 05 '17 10:03 Vincent--

Is this issue related to #390? (Probably not. This discussion here is about Debian < 9 only, isn't it?)

bittner avatar Nov 01 '17 11:11 bittner