voxpupuli / voxpupuli/puppet-php

php cli defaults to 7.0 update-alternatives

Open
#235 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
Puppet
Stars
86
Forks
264
Avg merge
29m
Merged PRs (30d)
1

Description

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'],
}`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how php::globals::php_version is applied when the PHP class configures the CLI, then compare that behavior with the update-alternatives command shown in the issue. Done means selecting the configured PHP version on Ubuntu instead of leaving PHP 7.0 active; no source files or tests are named.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, php, ubuntu
Domain
cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.