php cli defaults to 7.0 update-alternatives
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'], }`
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 yea, that would be better, thanks - but still maybe an issue for others and should be done in this module.
@star3am sure thing... could you open a pull request with that? :)
Should be in README, not a code change
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.
Is this issue related to #390? (Probably not. This discussion here is about Debian < 9 only, isn't it?)