2

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.

0

It looks more like this i think:

Apache Setup

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

Load extra apache modules

class { 'apache::mod::rewrite': }
class { 'apache::mod::status': }
class { 'apache::mod::php': }

You might also need:

package { 'php7.0':
ensure => 'installed',
}

package { 'libapache2-mod-php7.0':
ensure => 'installed',
}

package { 'libapache2-mod-php':
ensure => 'installed',
}

Hopefully that gets you closer.

0

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

I had the same problem. I was using an old version of the module puppetlabs-apache. I downloaded the current version (1.10.0 released on May 20th 2016) and now it is working properly because they fixed it.

Have a look at the file manifests/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'
}

As you can see, it will choose by default PHP 7 for Ubuntu 16.04. You don't even need to set php_version => 7.0 (as suggested by @starchx).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.