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

Wrong version of php installed on CentOS

Open benpollardcts opened this issue 6 years ago • 6 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.3.2
  • Ruby:
  • Distribution: CentOS Linux release 7.2.1511
  • Module version: 4.0.0-beta1

How to reproduce (e.g Puppet code you use)

class { '::php::globals': php_version => '5.5', } -> class { '::php': manage_repos => true, }

What are you seeing

Installs php version 5.6.31

What behaviour did you expect instead

install php version 5.5

Output log

Any additional information you'd like to impart

There doesn't appear to be any logic to install any version other than 5.6

benpollardcts avatar Jul 25 '17 22:07 benpollardcts

Same problem trying install. php 7.0, always get php 5.6.31

class { '::php::globals': php_version => '7.0', config_root => '/etc/php/7.0', }-> class { '::php': ensure => latest, manage_repos => true, fpm => true, dev => true, composer => true, pear => true, phpunit => false, }

alexwiedermann avatar Aug 31 '17 15:08 alexwiedermann

I'm having this same issue on Red Hat 7. Trying to install 7.0 and it installs 5.6

neilneyman avatar Oct 05 '17 15:10 neilneyman

Same issue here. I suspect it's because the package_prefix isn't set correctly for RedHat in https://github.com/voxpupuli/puppet-php/blob/master/manifests/globals.pp

A workaround is to set the package prefix manually. For example for PHP 7.1 the correct prefix for seems to be php71-php-. e.g.

  class { 'php':
    manage_repos   => true,
    package_prefix => 'php71-php-',
  }

php itself is installed by being pulled in as a dependency from common / cli so the prefix needs to be such that $prefix + cli/common resolves to a real package. In this case ph71-php-cli.

ExalDraen avatar May 04 '18 07:05 ExalDraen

I've not looked at this for a while as I ended up forking it a putting a hack in. But if I remember correctly it's the way it installs the remi repos for centos. A quick workaround is to set manage packages to false and declare them yourself

Yumrepo { 'remi-safe':
    descr      => 'Safe Remi\'s RPM repository for Enterprise Linux 7',
    mirrorlist => 'http://cdn.remirepo.net/enterprise/7/safe/mirror',
    enabled    => 1,
    gpgcheck   => 1,
    gpgkey     => 'http://rpms.remirepo.net/RPM-GPG-KEY-remi'
  }

  Yumrepo { 'remi-55':
    descr      => 'Remi\'s PHP 5.5 RPM repository for Enterprise Linux 7',
    mirrorlist => 'http://cdn.remirepo.net/enterprise/7/php55/mirror',
    enabled    => 1,
    gpgcheck   => 1,
    gpgkey     => 'http://rpms.remirepo.net/RPM-GPG-KEY-remi'
  }

I'll try and find some time so patch it properly at some point.

benpollardcts avatar May 04 '18 08:05 benpollardcts

This is a duplicate of https://github.com/voxpupuli/puppet-php/issues/344

siebrand avatar Nov 01 '18 08:11 siebrand

The problem im having now, is if no php on the system, and i add the prefix package_prefix => 'php73-php-', to php class, its not in the path still. It does install correctly though. I need to figure out how to add the symlink, or whatever it needs for all cli,php,fpm,cgi etc.. #344 didnt provide the working solution, i used @ExalDraen solution above.

e.g. which php73 works, but not which php

see my post on #344