我想使用Puppet Labs Apache模块在Ubuntu 16.04上安装PHP 7.0的Apache 。
问题是
以下代码(来自Puppet清单)在Ubuntu 16.04上不起作用
class { 'apache': mpm_module => 'prefork', } include apache::mod::php
我有以下错误
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install libapache2-mod-php5' returned 100: Reading package lists... Building dependency tree... Reading state information... Package libapache2-mod-php5 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'libapache2-mod-php5' has no installation candidate Error: /Stage[main]/Apache::Mod::Php/Apache::Mod[php5]/Package[libapache2-mod-php5]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install libapache2-mod-php5' returned 100: Reading package lists... Building dependency tree... Reading state information... Package libapache2-mod-php5 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'libapache2-mod-php5' has no installation candidate
我试图configurationFastCGI服务器来处理PHP文件,但是也出现了几乎相同的错误信息。 该模块还不了解PHP 7.0。
它看起来更像是这样我认为:
class { 'apache': mpm_module => 'prefork' } apache::listen { '80': } apache::listen { '443': }
class { 'apache::mod::rewrite': } class { 'apache::mod::status': } class { 'apache::mod::php': }
package { 'php7.0': ensure => 'installed', } package { 'libapache2-mod-php7.0': ensure => 'installed', } package { 'libapache2-mod-php': ensure => 'installed', }
希望让你更接近。
刚刚遇到类似的问题,显然Pupplelabs Apache mod现在允许你通过PHP版本作为参数:
class { 'apache::mod::php': php_version => '7', }
我有同样的问题。 我正在使用旧版本的模块puppetlabs-apache 。 我下载了当前版本(2016年5月20日发布的1.10.0 ),现在它工作正常,因为他们修复了它。
看看文件清单/ params.pp :
if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') < 0) or ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '9') < 0) { # Only the major version is used here $php_version = '5' } else { # major.minor version used since Debian stretch and Ubuntu Xenial $php_version = '7.0' }
正如你所看到的,它将默认selectUbuntu 16.04的PHP 7。 你甚至不需要设置php_version => 7.0 (正如@starchx所build议的)。