diff --git a/manifests/apache/config.pp b/manifests/apache/config.pp
index f29e92ee..f59f201d 100644
--- a/manifests/apache/config.pp
+++ b/manifests/apache/config.pp
@@ -34,7 +34,6 @@
   $section  = 'PHP',
   $value    = undef,
 ) {
-
   include ::php::apache::params
 
   if $file {
diff --git a/manifests/apache/params.pp b/manifests/apache/params.pp
index 0bafb227..d9a3d4a5 100644
--- a/manifests/apache/params.pp
+++ b/manifests/apache/params.pp
@@ -41,11 +41,37 @@
 class php::apache::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'libapache2-mod-php5'
   $provider = undef
-  $inifile  = '/etc/php/7.0/apache2/php.ini'
   $settings = [ ]
 
-  $service_name = 'apache2'
-
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $service_name   = 'apache2'
+            $package        = 'libapache2-mod-php7.0'
+            $inifile        = '/etc/php/7.0/apache2/php.ini'
+          } else {
+            $service_name   = 'apache2'
+            $package        = 'libapache2-mod-php5'
+            $inifile        = '/etc/php5/apache2/php.ini'
+          }
+        }
+        default: {
+          $server_name  = 'apache2'
+          $package      = 'libapache2-mod-php7.0'
+          $inifile      = '/etc/php/7.0/apache2/php.ini'
+        }
+      }
+    }
+    #
+    # @todo RedHat uses 'httpd' as service name
+    #
+    default: {
+      $service_name     = 'apache2'
+      $package          = 'libapache2-mod-php7.0'
+      $inifile          = '/etc/php/7.0/apache2/php.ini'
+    }
+  }
 }
diff --git a/manifests/cli/params.pp b/manifests/cli/params.pp
index 9dc9c603..fc6cb46e 100644
--- a/manifests/cli/params.pp
+++ b/manifests/cli/params.pp
@@ -41,9 +41,30 @@
 class php::cli::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-cli'
   $provider = undef
-  $inifile  = '/etc/php/7.0/cli/php.ini'
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $inifile        = '/etc/php/7.0/cli/php.ini'
+            $package        = 'php7.0-cli'
+          } else {
+            $inifile        = '/etc/php5/cli/php.ini'
+            $package        = 'php5-cli'
+          }
+        }
+        default: {
+          $inifile      = '/etc/php/7.0/cli/php.ini'
+          $package      = 'php7.0-cli'
+        }
+      }
+    }
+    default: {
+      $inifile      = '/etc/php/7.0/cli/php.ini'
+      $package      = 'php7.0-cli'
+    }
+  }
 }
diff --git a/manifests/composer.pp b/manifests/composer.pp
index 67812c81..457248f0 100644
--- a/manifests/composer.pp
+++ b/manifests/composer.pp
@@ -27,6 +27,7 @@
 # Copyright 2012-2015 Christian "Jippi" Winther, unless otherwise noted.
 #
 class php::composer (
+  $cli_package  = $php::composer::params::cli_package,
   $source       = $php::composer::params::source,
   $destination  = $php::composer::params::destination
 ) inherits php::composer::params {
@@ -36,7 +37,7 @@
     creates => $destination,
     path    => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ],
     require => [
-      Package['php7.0-cli']
+      Package[$cli_package]
     ]
   }
 
@@ -46,5 +47,4 @@
     group   => root,
     require => Exec['download composer'],
   }
-
 }
diff --git a/manifests/composer/params.pp b/manifests/composer/params.pp
index 30e39565..846de18f 100644
--- a/manifests/composer/params.pp
+++ b/manifests/composer/params.pp
@@ -34,4 +34,24 @@
   $max_age     = 30
   $source      = 'https://getcomposer.org/composer.phar'
   $destination = '/usr/local/bin/composer'
+
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $cli_package    = 'php7.0-cli'
+          } else {
+            $cli_package    = 'php5-cli'
+          }
+        }
+        default: {
+          $cli_package  = 'php7.0-cli'
+        }
+      }
+    }
+    default: {
+      $cli_package  = 'php7.0-cli'
+    }
+  }
 }
diff --git a/manifests/contrib/base_package.pp b/manifests/contrib/base_package.pp
index b240a2c7..9ade41b8 100644
--- a/manifests/contrib/base_package.pp
+++ b/manifests/contrib/base_package.pp
@@ -32,9 +32,28 @@
   $ensure,
   $provider = undef
 ) {
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-common'
+          } else {
+            $package        = 'php5-common'
+          }
+        }
+        default: {
+          $package      = 'php7.0-common'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-common'
+    }
+  }
 
-  if !defined(Package['php7.0-common']) {
-    package { 'php7.0-common':
+  if !defined(Package[$package]) {
+    package { $package:
       ensure   => $ensure,
       provider => $provider
     }
diff --git a/manifests/dev/params.pp b/manifests/dev/params.pp
index 50c6ea95..97e28fdf 100644
--- a/manifests/dev/params.pp
+++ b/manifests/dev/params.pp
@@ -34,7 +34,25 @@
 class php::dev::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-dev'
   $provider = undef
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-dev'
+          } else {
+            $package        = 'php5-dev'
+          }
+        }
+        default: {
+          $package      = 'php7.0-dev'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-dev'
+    }
+  }
 }
diff --git a/manifests/extension/apc/params.pp b/manifests/extension/apc/params.pp
index f6d5519b..0f1d6933 100644
--- a/manifests/extension/apc/params.pp
+++ b/manifests/extension/apc/params.pp
@@ -41,24 +41,29 @@
 class php::extension::apc::params {
 
   $ensure   = $php::params::ensure
-  $package  = $::lsbdistcodename ? {
-    # php-apc is phased out as of Ubuntu 13.10 (saucy)
-    # and Debian jessie in favour of php5-apcu
-    # Debian
-    'squeeze' => 'php-apc',
-    'wheezy' => 'php-apc',
-
-    # Ubuntu
-    'lucid' => 'php-apc',
-    'precise' => 'php-apc',
-    'quantal' => 'php-apc',
-    'raring' => 'php-apc',
-
-    # Default to support future distros cleanly.
-    default => 'php7.0-apcu',
-  }
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/apc.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '8') == 0) {
+            $package    = 'php5-apcu'
+          } elsif (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package    = 'php-apcu'
+          } else {
+            $package    = 'php-apc'
+          }
+        }
+        default: {
+          $package      = 'php-apcu'
+        }
+      }
+    }
+    default: {
+      $package      = 'php-apcu'
+    }
+  }
 }
diff --git a/manifests/extension/apcu/params.pp b/manifests/extension/apcu/params.pp
index f8bf0a3d..4a831b1b 100644
--- a/manifests/extension/apcu/params.pp
+++ b/manifests/extension/apcu/params.pp
@@ -41,8 +41,27 @@
 class php::extension::apcu::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-apcu'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/apcu.ini"
   $settings = []
+
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php-apcu'
+          } else {
+            $package        = 'php5-apcu'
+          }
+        }
+        default: {
+          $package      = 'php-apcu'
+        }
+      }
+    }
+    default: {
+      $package      = 'php-apcu'
+    }
+  }
 }
diff --git a/manifests/extension/curl/params.pp b/manifests/extension/curl/params.pp
index 8a4daa6f..8157ef77 100644
--- a/manifests/extension/curl/params.pp
+++ b/manifests/extension/curl/params.pp
@@ -41,9 +41,27 @@
 class php::extension::curl::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-curl'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/curl.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-curl'
+          } else {
+            $package        = 'php5-curl'
+          }
+        }
+        default: {
+          $package      = 'php7.0-curl'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-curl'
+    }
+  }
 }
diff --git a/manifests/extension/gd/params.pp b/manifests/extension/gd/params.pp
index 7e7ff876..0cb68e9a 100644
--- a/manifests/extension/gd/params.pp
+++ b/manifests/extension/gd/params.pp
@@ -41,9 +41,27 @@
 class php::extension::gd::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-gd'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/gd.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-gd'
+          } else {
+            $package        = 'php5-gd'
+          }
+        }
+        default: {
+          $package      = 'php7.0-gd'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-gd'
+    }
+  }
 }
diff --git a/manifests/extension/gearman/params.pp b/manifests/extension/gearman/params.pp
index e34fb559..e702bc60 100644
--- a/manifests/extension/gearman/params.pp
+++ b/manifests/extension/gearman/params.pp
@@ -41,9 +41,27 @@
 class php::extension::gearman::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-gearman'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/gearman.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php-gearman'
+          } else {
+            $package        = 'php5-gearman'
+          }
+        }
+        default: {
+          $package      = 'php-gearman'
+        }
+      }
+    }
+    default: {
+      $package      = 'php-gearman'
+    }
+  }
 }
diff --git a/manifests/extension/http/params.pp b/manifests/extension/http/params.pp
index de3304fc..fa647052 100644
--- a/manifests/extension/http/params.pp
+++ b/manifests/extension/http/params.pp
@@ -46,4 +46,23 @@
   $inifile  = "${php::params::config_root_ini}/http.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php-http'
+          } else {
+            warning('php::extension::http package does not exists on php5')
+          }
+        }
+        default: {
+          $package      = 'php-http'
+        }
+      }
+    }
+    default: {
+      $package      = 'php-http'
+    }
+  }
 }
diff --git a/manifests/extension/igbinary/params.pp b/manifests/extension/igbinary/params.pp
index 53bd3516..1cd3f9ea 100644
--- a/manifests/extension/igbinary/params.pp
+++ b/manifests/extension/igbinary/params.pp
@@ -41,9 +41,27 @@
 class php::extension::igbinary::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-igbinary'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/igbinary.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php-igbinary'
+          } else {
+            $package        = 'php5-igbinary'
+          }
+        }
+        default: {
+          $package      = 'php-igbinary'
+        }
+      }
+    }
+    default: {
+      $package      = 'php-igbinary'
+    }
+  }
 }
diff --git a/manifests/extension/imagick/params.pp b/manifests/extension/imagick/params.pp
index c9cdb274..3ec0fe03 100644
--- a/manifests/extension/imagick/params.pp
+++ b/manifests/extension/imagick/params.pp
@@ -41,9 +41,27 @@
 class php::extension::imagick::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-imagick'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/imagick.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php-imagick'
+          } else {
+            $package        = 'php5-imagick'
+          }
+        }
+        default: {
+          $package      = 'php-imagick'
+        }
+      }
+    }
+    default: {
+      $package      = 'php-imagick'
+    }
+  }
 }
diff --git a/manifests/extension/imap/params.pp b/manifests/extension/imap/params.pp
index 23f5a52f..8a8d1f18 100644
--- a/manifests/extension/imap/params.pp
+++ b/manifests/extension/imap/params.pp
@@ -41,8 +41,27 @@
 class php::extension::imap::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-imap'
   $provider = undef
-  $inifile  = '/etc/php/conf.d/imap.ini'
+  $inifile  = "${php::params::config_root_ini}/imap.ini"
   $settings = []
+
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-imap'
+          } else {
+            $package        = 'php5-imap'
+          }
+        }
+        default: {
+          $package      = 'php7.0-imap'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-imap'
+    }
+  }
 }
diff --git a/manifests/extension/intl/params.pp b/manifests/extension/intl/params.pp
index 6e05b100..3cfe8a25 100644
--- a/manifests/extension/intl/params.pp
+++ b/manifests/extension/intl/params.pp
@@ -41,9 +41,27 @@
 class php::extension::intl::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-intl'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/intl.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-intl'
+          } else {
+            $package        = 'php5-intl'
+          }
+        }
+        default: {
+          $package      = 'php7.0-intl'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-intl'
+    }
+  }
 }
diff --git a/manifests/extension/jsmin/params.pp b/manifests/extension/jsmin/params.pp
index 513e1181..c13d1669 100644
--- a/manifests/extension/jsmin/params.pp
+++ b/manifests/extension/jsmin/params.pp
@@ -47,5 +47,4 @@
   $settings = [
     'set ".anon/extension" "jsmin.so"'
   ]
-
 }
diff --git a/manifests/extension/ldap/params.pp b/manifests/extension/ldap/params.pp
index b4129650..a8e09ba7 100644
--- a/manifests/extension/ldap/params.pp
+++ b/manifests/extension/ldap/params.pp
@@ -41,8 +41,27 @@
 class php::extension::ldap::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php5-ldap'
   $provider = undef
   $inifile  = '/etc/php/7.0/conf.d/20-ldap.ini'
   $settings = []
+
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-ldap'
+          } else {
+            $package        = 'php5-ldap'
+          }
+        }
+        default: {
+          $package      = 'php7.0-ldap'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-ldap'
+    }
+  }
 }
diff --git a/manifests/extension/mcrypt/params.pp b/manifests/extension/mcrypt/params.pp
index 044f863f..4e103516 100644
--- a/manifests/extension/mcrypt/params.pp
+++ b/manifests/extension/mcrypt/params.pp
@@ -41,9 +41,27 @@
 class php::extension::mcrypt::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-mcrypt'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/mcrypt.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-mcrypt'
+          } else {
+            $package        = 'php5-mcrypt'
+          }
+        }
+        default: {
+          $package      = 'php7.0-mcrypt'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-mcrypt'
+    }
+  }
 }
diff --git a/manifests/extension/memcache/params.pp b/manifests/extension/memcache/params.pp
index 262fdc67..ecc45931 100644
--- a/manifests/extension/memcache/params.pp
+++ b/manifests/extension/memcache/params.pp
@@ -42,9 +42,27 @@
 class php::extension::memcache::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-memcache'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/memcache.ini"
   $settings = []
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php-memcache'
+          } else {
+            $package        = 'php5-memcache'
+          }
+        }
+        default: {
+          $package      = 'php-memcache'
+        }
+      }
+    }
+    default: {
+      $package      = 'php-memcache'
+    }
+  }
 }
diff --git a/manifests/extension/memcached/params.pp b/manifests/extension/memcached/params.pp
index 16d57577..896446e7 100644
--- a/manifests/extension/memcached/params.pp
+++ b/manifests/extension/memcached/params.pp
@@ -42,9 +42,27 @@
 class php::extension::memcached::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-memcached'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/memcached.ini"
   $settings = []
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php-memcached'
+          } else {
+            $package        = 'php5-memcached'
+          }
+        }
+        default: {
+          $package      = 'php-memcached'
+        }
+      }
+    }
+    default: {
+      $package      = 'php-memcached'
+    }
+  }
 }
diff --git a/manifests/extension/mongo/params.pp b/manifests/extension/mongo/params.pp
index 8cc1cc21..00b52fb1 100644
--- a/manifests/extension/mongo/params.pp
+++ b/manifests/extension/mongo/params.pp
@@ -42,11 +42,35 @@
 class php::extension::mongo::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'mongo'
-  $provider = 'pecl'
+  $package  = undef
+  $provider = undef
   $inifile  = "${php::params::config_root_ini}/mongo.ini"
-  $settings = [
-    'set ".anon/extension" "mongo.so"'
-  ]
+  $settings = undef
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package    = 'php-mongodb'
+            $settings   = []
+          } else {
+            $package    = 'mongo'
+            $provider   = 'pecl'
+            $settings   = [
+                'set ".anon/extension" "mongo.so"'
+            ]
+          }
+        }
+        default: {
+          $package      = 'php-mongodb'
+          $settings     = []
+        }
+      }
+    }
+    default: {
+      $package      = 'php-mongodb'
+      $settings     = []
+    }
+  }
 }
diff --git a/manifests/extension/mysql/params.pp b/manifests/extension/mysql/params.pp
index b2996988..a84ce836 100644
--- a/manifests/extension/mysql/params.pp
+++ b/manifests/extension/mysql/params.pp
@@ -41,9 +41,27 @@
 class php::extension::mysql::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-mysql'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/mysql.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-mysql'
+          } else {
+            $package        = 'php5-mysql'
+          }
+        }
+        default: {
+          $package      = 'php7.0-mysql'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-mysql'
+    }
+  }
 }
diff --git a/manifests/extension/mysqlnd/params.pp b/manifests/extension/mysqlnd/params.pp
index 82198fe8..6ef89a1e 100644
--- a/manifests/extension/mysqlnd/params.pp
+++ b/manifests/extension/mysqlnd/params.pp
@@ -41,9 +41,27 @@
 class php::extension::mysqlnd::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-mysqlnd'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/mysqlnd.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-mysql'
+          } else {
+            $package        = 'php5-mysqlnd'
+          }
+        }
+        default: {
+          $package      = 'php7.0-mysql'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-mysql'
+    }
+  }
 }
diff --git a/manifests/extension/newrelic/params.pp b/manifests/extension/newrelic/params.pp
index a5d9eaab..6215f775 100644
--- a/manifests/extension/newrelic/params.pp
+++ b/manifests/extension/newrelic/params.pp
@@ -41,9 +41,27 @@
 class php::extension::newrelic::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'newrelic-php5'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/newrelic.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'newrelic-php7'
+          } else {
+            $package        = 'newrelic-php5'
+          }
+        }
+        default: {
+          $package      = 'newrelic-php5'
+        }
+      }
+    }
+    default: {
+      $package      = 'newrelic-php5'
+    }
+  }
 }
diff --git a/manifests/extension/pgsql/params.pp b/manifests/extension/pgsql/params.pp
index f15c0e31..52a8f3f0 100644
--- a/manifests/extension/pgsql/params.pp
+++ b/manifests/extension/pgsql/params.pp
@@ -41,8 +41,27 @@
 class php::extension::pgsql::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-pgsql'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/pgsql.ini"
   $settings = [ ]
+
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-pgsql'
+          } else {
+            $package        = 'php5-pgsql'
+          }
+        }
+        default: {
+          $package      = 'php7.0-pgsql'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-pgsql'
+    }
+  }
 }
diff --git a/manifests/extension/redis/params.pp b/manifests/extension/redis/params.pp
index af3c5613..b3a867e9 100644
--- a/manifests/extension/redis/params.pp
+++ b/manifests/extension/redis/params.pp
@@ -41,9 +41,27 @@
 class php::extension::redis::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-redis'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/redis.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php-redis'
+          } else {
+            $package        = 'php5-redis'
+          }
+        }
+        default: {
+          $package      = 'php-redis'
+        }
+      }
+    }
+    default: {
+      $package      = 'php-redis'
+    }
+  }
 }
diff --git a/manifests/extension/sqlite/params.pp b/manifests/extension/sqlite/params.pp
index abba9fbd..e1dc4ece 100644
--- a/manifests/extension/sqlite/params.pp
+++ b/manifests/extension/sqlite/params.pp
@@ -41,8 +41,27 @@
 class php::extension::sqlite::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-sqlite'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/sqlite.ini"
   $settings = [ ]
+
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-sqlite3'
+          } else {
+            $package        = 'php5-sqlite'
+          }
+        }
+        default: {
+          $package      = 'php7.0-sqlite3'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-sqlite3'
+    }
+  }
 }
diff --git a/manifests/extension/ssh2/params.pp b/manifests/extension/ssh2/params.pp
index 9ada1fb2..de1a0910 100644
--- a/manifests/extension/ssh2/params.pp
+++ b/manifests/extension/ssh2/params.pp
@@ -41,9 +41,27 @@
 class php::extension::ssh2::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-ssh2'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/ssh2.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php-ssh2'
+          } else {
+            $package        = 'php5-ssh2'
+          }
+        }
+        default: {
+          $package      = 'php-ssh2'
+        }
+      }
+    }
+    default: {
+      $package      = 'php-ssh2'
+    }
+  }
 }
diff --git a/manifests/extension/tidy/params.pp b/manifests/extension/tidy/params.pp
index 252c2956..5896ae2d 100644
--- a/manifests/extension/tidy/params.pp
+++ b/manifests/extension/tidy/params.pp
@@ -42,9 +42,27 @@
 class php::extension::tidy::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-tidy'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/tidy.ini"
   $settings = [ ]
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php7.0-tidy'
+          } else {
+            $package        = 'php5-tidy'
+          }
+        }
+        default: {
+          $package      = 'php7.0-tidy'
+        }
+      }
+    }
+    default: {
+      $package      = 'php7.0-tidy'
+    }
+  }
 }
diff --git a/manifests/extension/xcache/params.pp b/manifests/extension/xcache/params.pp
index 15847edc..00674584 100644
--- a/manifests/extension/xcache/params.pp
+++ b/manifests/extension/xcache/params.pp
@@ -41,9 +41,27 @@
 class php::extension::xcache::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-xcache'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/xcache.ini"
   $settings = []
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            warning('php::extension::xcache is not compatible with Debian >= 9')
+          } else {
+            $package        = 'php5-xcache'
+          }
+        }
+        default: {
+          warning('php::extension::xcache is not compatible with Debian based systems')
+        }
+      }
+    }
+    default: {
+      $package      = 'php-xcache'
+    }
+  }
 }
diff --git a/manifests/extension/xdebug/params.pp b/manifests/extension/xdebug/params.pp
index ab5ddcbb..e47851ed 100644
--- a/manifests/extension/xdebug/params.pp
+++ b/manifests/extension/xdebug/params.pp
@@ -44,12 +44,34 @@
 class php::extension::xdebug::params {
 
   $ensure      = $php::params::ensure
-  $package     = 'php7.0-xdebug'
   $provider    = undef
-  $install_dir = "/usr/lib/php5/${::php_extension_version}"
   $inifile     = "${php::params::config_root_ini}/xdebug.ini"
+
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $install_dir    = "/usr/lib/php/${::php_extension_version}"
+            $package        = 'php-xdebug'
+          } else {
+            $install_dir    = "/usr/lib/php5/${::php_extension_version}"
+            $package        = 'php5-xdebug'
+          }
+        }
+        default: {
+          $install_dir  = "/usr/lib/php/${::php_extension_version}"
+          $package      = 'php-xdebug'
+        }
+      }
+    }
+    default: {
+      $install_dir  = "/usr/lib/php/${::php_extension_version}"
+      $package      = 'php-xdebug'
+    }
+  }
+
   $settings    = [
     "set .anon/zend_extension '${install_dir}/xdebug.so'"
   ]
-
 }
diff --git a/manifests/extension/yaml/params.pp b/manifests/extension/yaml/params.pp
index a9133173..35a5ddaf 100644
--- a/manifests/extension/yaml/params.pp
+++ b/manifests/extension/yaml/params.pp
@@ -41,9 +41,27 @@
 class php::extension::yaml::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php7.0-yaml'
   $provider = undef
   $inifile  = "${php::params::config_root_ini}/yaml.ini"
   $settings = []
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php-yaml'
+          } else {
+            $package        = 'php5-yaml'
+          }
+        }
+        default: {
+          $package      = 'php-yaml'
+        }
+      }
+    }
+    default: {
+      $package      = 'php-yaml'
+    }
+  }
 }
diff --git a/manifests/fpm.pp b/manifests/fpm.pp
index 1b2ae643..1c8efebb 100644
--- a/manifests/fpm.pp
+++ b/manifests/fpm.pp
@@ -52,6 +52,7 @@
   $service_provider   = $php::fpm::params::service_provider,
 
   # settings for php-fpm.conf
+  $fpm_config                   = $php::fpm::params::fpm_config,
   $pid                          = $php::fpm::params::pid,
   $error_log                    = $php::fpm::params::error_log,
   $syslog_facility              = $php::fpm::params::syslog_facility,
@@ -66,6 +67,7 @@
   $rlimit_core                  = $php::fpm::params::rlimit_core,
   $events_mechanism             = $php::fpm::params::events_mechanism,
 
+  $config_root                  = $php::params::config_root
 ) inherits php::fpm::params {
 
   class  { 'php::fpm::package':
@@ -90,7 +92,7 @@
     require => Package[$package]
   }
 
-  file { '/etc/php/7.0/fpm/php-fpm.conf':
+  file { $fpm_config:
     notify  => Service[$service_name],
     content => template('php/fpm/php-fpm.conf.erb'),
     owner   => root,
diff --git a/manifests/fpm/params.pp b/manifests/fpm/params.pp
index 28d8c680..c428e1fb 100644
--- a/manifests/fpm/params.pp
+++ b/manifests/fpm/params.pp
@@ -41,20 +41,17 @@
 class php::fpm::params inherits php::params {
 
   $ensure             = $::php::params::ensure
-  $package            = 'php7.0-fpm'
   $provider           = undef
-  $inifile            = '/etc/php/7.0/fpm/php.ini'
   $settings           = [ ]
 
-  $service_name       = 'php7.0-fpm'
   $service_ensure     = 'running'
   $service_enable     = true
   $service_has_status = true
   $service_provider   = undef
 
   # default params for php-fpm.conf, ported from php::fpm::daemon
-  $pid                          = '/var/run/php7.0-fpm.pid'
-  $error_log                    = '/var/log/php7.0-fpm.log'
+  $fpm_config                   = "${::php::params::config_root}/fpm/php-fpm.conf"
+  $inifile                      = "${::php::params::config_root}/fpm/php.ini"
   $syslog_facility              = undef
   $syslog_ident                 = undef
   $log_level                    = 'notice'
@@ -68,4 +65,36 @@
   $rlimit_core                  = 0
   $events_mechanism             = undef
 
-}
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $pid            = '/var/run/php7.0-fpm.pid'
+            $error_log      = '/var/log/php7.0-fpm.log'
+            $package        = 'php7.0-fpm'
+            $service_name   = 'php7.0-fpm'
+          } else {
+            $pid            = '/var/run/php5-fpm.pid'
+            $error_log      = '/var/log/php5-fpm.log'
+            $package        = 'php5.0-fpm'
+            $service_name   = 'php5.0-fpm'
+          }
+        }
+        default: {
+          $pid          = '/var/run/php7.0-fpm.pid'
+          $error_log    = '/var/log/php7.0-fpm.log'
+          $package      = 'php7.0-fpm'
+          $service_name = 'php7.0-fpm'
+        }
+      }
+    }
+    default: {
+      $pid          = '/var/run/php7.0-fpm.pid'
+      $error_log    = '/var/log/php7.0-fpm.log'
+      $inifile      = '/etc/php/7.0/fpm/php.ini'
+      $package      = 'php7.0-fpm'
+      $service_name = 'php7.0-fpm'
+    }
+  }
+} 
diff --git a/manifests/fpm/pool.pp b/manifests/fpm/pool.pp
index 24d27c40..daf30c40 100644
--- a/manifests/fpm/pool.pp
+++ b/manifests/fpm/pool.pp
@@ -64,20 +64,19 @@
   $group_final = $group ? { undef => $user, default => $group }
 
   if ($ensure == 'absent') {
-    file { "/etc/php/7.0/fpm/pool.d/${pool}.conf":
+    file { "${::php::params::config_root}/fpm/pool.d/${pool}.conf":
       ensure => absent,
-      notify => Service['php7.0-fpm']
+      notify => Service[$::php::fpm::params::service_name]
     }
   } else {
-    file { "/etc/php/7.0/fpm/pool.d/${pool}.conf":
+    file { "${::php::params::config_root}/fpm/pool.d/${pool}.conf":
       ensure  => file,
-      notify  => Service['php7.0-fpm'],
-      require => Package['php7.0-fpm'],
+      notify  => Service[$::php::fpm::params::service_name],
+      require => Package[$::php::fpm::params::package],
       content => template('php/fpm/pool.conf.erb'),
       owner   => root,
       group   => root,
       mode    => $config_mode,
     }
   }
-
 }
diff --git a/manifests/params.pp b/manifests/params.pp
index e20a03d3..37361af9 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -28,15 +28,31 @@
 class php::params {
 
   $ensure = 'installed'
+  $augeas_contrib_dir = '/usr/share/augeas/lenses/contrib'
 
-  $config_root = '/etc/php'
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $config_root    = '/etc/php/7.0'
+          } else {
+            $config_root    = '/etc/php5'
+          }
+        }
+        default: {
+          $config_root  = '/etc/php/7.0'
+        }
+      }
+    }
+    default: {  
+      $config_root  = '/etc/php/7.0'
+    }
+  }
 
   if $::php_version == '' or versioncmp($::php_version, '5.4') >= 0 {
-    $config_root_ini = "${::php::params::config_root}/mods-available"
+    $config_root_ini = "${config_root}/mods-available"
   } else {
-    $config_root_ini = "${::php::params::config_root}/conf.d"
+    $config_root_ini = "${config_root}/conf.d"
   }
-
-  $augeas_contrib_dir = '/usr/share/augeas/lenses/contrib'
-
 }
diff --git a/manifests/pear/params.pp b/manifests/pear/params.pp
index bc91fafe..9a628163 100644
--- a/manifests/pear/params.pp
+++ b/manifests/pear/params.pp
@@ -46,7 +46,25 @@
 class php::pear::params {
 
   $ensure   = $php::params::ensure
-  $package  = 'php-pear'
   $provider = undef
 
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $package        = 'php-pear'
+          } else {
+            $package        = 'php-pear'
+          }
+        }
+        default: {
+          $package      = 'php-pear'
+        }
+      }
+    }
+    default: {
+      $package      = 'php-pear'
+    }
+  }
 }
diff --git a/manifests/phpunit.pp b/manifests/phpunit.pp
index a14436fa..bc2ee121 100644
--- a/manifests/phpunit.pp
+++ b/manifests/phpunit.pp
@@ -27,6 +27,7 @@
 #
 
 class php::phpunit (
+  $cli_package = $php::phpunit::params::cli_package,
   $ensure      = $php::phpunit::params::ensure,
   $source      = $php::phpunit::params::source,
   $destination = $php::phpunit::params::destination
@@ -42,7 +43,7 @@
       command => "wget ${source} -O ${destination}",
       creates => $destination,
       path    => [ '/bin', '/sbin' , '/usr/bin', '/usr/sbin' ],
-      require => Package['php5-cli'],
+      require => Package[$cli_package],
       before  => File[$destination]
     }
   }
diff --git a/manifests/phpunit/params.pp b/manifests/phpunit/params.pp
index 6216444b..2729a2f6 100644
--- a/manifests/phpunit/params.pp
+++ b/manifests/phpunit/params.pp
@@ -42,4 +42,24 @@
   $ensure   = $php::params::ensure
   $source = 'https://phar.phpunit.de/phpunit.phar'
   $destination = '/usr/local/bin/phpunit'
+  
+  case $::osfamily {
+    'Debian': {
+      case $::operatingsystem {
+        'Debian': {
+          if (versioncmp($::operatingsystemrelease, '9') >= 0) {
+            $cli_package    = 'php7.0-cli'
+          } else {
+            $cli_package    = 'php5-cli'
+          }
+        }
+        default: {
+          $cli_package  = 'php7.0-cli'
+        }
+      }
+    }
+    default: {
+      $cli_package  = 'php7.0-cli'
+    }
+  }
 }
diff --git a/templates/fpm/php-fpm.conf.erb b/templates/fpm/php-fpm.conf.erb
index 1aa58972..2ad986c5 100644
--- a/templates/fpm/php-fpm.conf.erb
+++ b/templates/fpm/php-fpm.conf.erb
@@ -142,4 +142,5 @@ events.mechanism = <%= @events_mechanism %>
 ; Relative path can also be used. They will be prefixed by:
 ;  - the global prefix if it's been set (-p argument)
 ;  - /usr otherwise
-include=/etc/php/7.0/fpm/pool.d/*.conf
+include=<%= @config_root -%>/fpm/pool.d/*.conf
+