puppet-php
puppet-php copied to clipboard
Possibility to install PHP 5.6 on Debian 9
The Debian 9 repository only has PHP version 7.0 so if I use this puppet-php module on Debian 9 I can only install version 7.0.
Now I have a project requiring PHP 5.6 on Debian 9, for that purpose one can use the https://packages.sury.org/php/ repository which offers PHP 5.6 for Debian 9 but that would require installing it manually (not using this puppet module).
So it would be great if this module would support this third-party repository in order to be able to install other versions of PHP. By the way this repo has PHP versions 5.6, 7.0, 7.1 and 7.2 available for Debian 9 (and 8 IIRC).
In addition, I get a compile error when running tests over our control repository using PDK v1.2.1:
$ pdk test unit 2> /dev/null
failed: rspec: ./spec/classes/role_server_customer_standalone_spec.rb:10: error during compilation: Evaluation Error: Unknown variable: '::lsbdistcodenameid'. at /builds/comsolit/puppet-control/spec/fixtures/modules/php/manifests/params.pp:38:27 on node runner-4c61c68a-project-186-concurrent-0.comsolit.local
role::server::customer_standalone on debian-9-x86_64 should compile into a catalogue without dependency cycles
Failure/Error:
end
it { is_expected.to compile.with_all_deps }
end
end
failed: rspec: ./spec/classes/role_workstation_backoffice_spec.rb:14: error during compilation: Evaluation Error: Error while evaluating a Function Call, The software module is not supported on Debian with version 9.1. at /builds/comsolit/puppet-control/spec/fixtures/modules/software/manifests/params.pp:192:5 on node runner-4c61c68a-project-186-concurrent-0.comsolit.local
role::workstation::backoffice on debian-9-x86_64 should compile into a catalogue without dependency cycles
Failure/Error:
end
it { is_expected.to compile.with_all_deps }
end
end
failed: rspec: ./spec/classes/role_workstation_developer_spec.rb:14: error during compilation: Evaluation Error: Error while evaluating a Function Call, The software module is not supported on Debian with version 9.1. at /builds/comsolit/puppet-control/spec/fixtures/modules/software/manifests/params.pp:192:5 on node runner-4c61c68a-project-186-concurrent-0.comsolit.local
role::workstation::developer on debian-9-x86_64 should compile into a catalogue without dependency cycles
Failure/Error:
end
it { is_expected.to compile.with_all_deps }
end
end
This is probably due to the (deliberate?) restriction of the supported Debian versions.
Is Debian 9 meant to be added to the module metadata?
This can be accomplished with the current version by adding the sury repo 'by hand' (in your own module or profile). In theory, this part could be added to the module when the module runs on Debian 9 and PHP 5.6 is requested, but that might conflict with people manually adding the repo.
Then configure this module like this:
class { '::php::globals':
config_root => '/etc/php/5.6',
php_version => '5.6',
}
class { '::php':
ensure => latest,
manage_repos => false,
ext_tool_query => '/usr/sbin/phpquery -v 5.6',
ext_tool_enable => '/usr/sbin/phpenmod -v 5.6',
package_prefix => 'php5.6-',
fpm_service_name => 'php5.6-fpm',
fpm => true,
}
I think this should be enough to make the module compatible with PHP 5.6. But only when using the Sury repo.
Thanks @eborned for the workaround. Will try it when I get some time. I think it would be useful to share this piece of information through the official documentation of this module.
This does the job:
php::globals::php_version: '5.6'
php::manage_repos: true
php::repo::debian::location: 'https://packages.sury.org/php'
php::repo::debian::release: "%{facts.os.distro.codename}"
php::repo::debian::repos: 'main'
php::repo::debian::key:
id : 'DF3D585DB8F0EB658690A554AC0E47584A7A714D'
source : 'https://packages.sury.org/php/apt.gpg'
php::repo::debian::dotdeb: false
@jonhattan nice workaround it works well for me 👍 there is only one small modification I had to do for Debian 9 with puppet 4:
php::repo::debian::release: "%{::lsbdistcodename}"
@hostingnuggets are there any open questions for this issue or can you close it?
@SimonHoenscheid all good but would be nice to have this documented maybe as it is a workaround really.
Debian Sury repo support is on the way currently AFAIK. Then this will be part of the docs. @bastelfreak can you say a bit more about this?
@SimonHoenscheid :+1: for Debian Sury repo support
i tried to install php 5.6 on debian9 with sury and it didn't work because of how the globals currently work:
case $globals_php_version {
/^7\.[0-9]/: {
$default_config_root = "/etc/php/${globals_php_version}"
$default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid"
$fpm_error_log = "/var/log/php${globals_php_version}-fpm.log"
$fpm_service_name = "php${globals_php_version}-fpm"
$ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}"
$ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}"
$package_prefix = "php${globals_php_version}-"
}
default: {
$default_config_root = '/etc/php5'
$default_fpm_pid_file = '/var/run/php5-fpm.pid'
$fpm_error_log = '/var/log/php5-fpm.log'
$fpm_service_name = 'php5-fpm'
$ext_tool_enable = '/usr/sbin/php5enmod'
$ext_tool_query = '/usr/sbin/php5query'
$package_prefix = 'php5-'
}
all packages are prefixed as php5 and not as php5.6 so it comes to an error with sury as there the name php5.6 is required.
i did a quick ugly hack in my fork. by simply adding (yeah i know i could have changed the regex of the current php7.
/^5\.6/: {
$default_config_root = "/etc/php/${globals_php_version}"
$default_fpm_pid_file = "/var/run/php/php${globals_php_version}-fpm.pid"
$fpm_error_log = "/var/log/php${globals_php_version}-fpm.log"
$fpm_service_name = "php${globals_php_version}-fpm"
$ext_tool_enable = "/usr/sbin/phpenmod -v ${globals_php_version}"
$ext_tool_query = "/usr/sbin/phpquery -v ${globals_php_version}"
$package_prefix = "php${globals_php_version}-"
}
to make it clean we also need a os detection for deb9.
as soon as my huge workload because of GDPR is over, i will continue to work an my open PR here.