阿帕契設置

阿帕契設置

我想在 Ubuntu 16.04 上使用 PHP 7.0 安裝 ApachePuppet Labs Apache 模組

  1. 依照文件模組支援Ubuntu 16.04
  2. 有一個與 PHP 7.0 支援相關的票證並且有一個公認的合併請求應該要加入 PHP 7.0 支援。
  3. 看起來合併中提供的修復未包含在模組 1.9.0 版本中。

問題是

  1. 有辦法使用建議的修復並使用 PHP 7.0 安裝 Apache 嗎?
  2. 我該在清單中寫什麼?

以下程式碼(來自 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

我嘗試過了配置 FastCGI 伺服器來處理 PHP 文件但這也失敗了,並顯示幾乎相同的錯誤訊息。本模組尚不了解 PHP 7.0。

答案1

剛剛遇到了類似的問題,顯然 Pupplelabs Apache mod 現在允許您傳入 PHP 版本作為參數:

  class { 'apache::mod::php':
    php_version => '7',
  }

答案2

我有同樣的問題。我使用的是舊版的模組puppetlabs-apache。我下載了當前版本(1.10.0於 2016 年 5 月 20 日發布),現在它可以正常工作,因為他們修復了它。

看一下文件清單/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'
}

如您所見,Ubuntu 16.04 預設會選擇 PHP 7。您甚至不需要設定php_version => 7.0(按照@starchx的建議)。

答案3

我認為它看起來更像是這樣的:

阿帕契設置

class { 'apache':
    mpm_module => 'prefork'
  }
     apache::listen { '80': }
     apache::listen { '443': }

載入額外的 apache 模組

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

希望這能讓你們更親近。

相關內容