How to install Apache with PHP 7.0 on Ubuntu 16.04 using puppetlabs-apache

I want to install Apache with PHP 7.0 on Ubuntu 16.04 using Puppet Labs Apache module.

  1. Following the documentation the module supports Ubuntu 16.04.
  2. There is a ticket related with PHP 7.0 support and there is an accepted merge request which should add PHP 7.0 support.
  3. It looks like the fix provided in the merge is not included in module 1.9.0 version.

The questions are

  1. Is there any way how I can use the suggested fix and install Apache with PHP 7.0?
  2. What should I write in the manifest?

The following code (from Puppet manifest) does not work on Ubuntu 16.04

class { 'apache':
  mpm_module    => 'prefork',
}
include apache::mod::php

I've got the following error

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

I tried to configure FastCGI servers to handle PHP files but this fails too with almost the same error message. The module knows nothing about PHP 7.0 yet.


Just came across a similar issue, and apparently Pupplelabs Apache mod now allows you pass in PHP version as parameter:

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