thias / puppet-php

Puppet module to manage PHP
Other
49 stars 67 forks source link

Using php 5.5 #13

Closed jacinto123 closed 11 years ago

jacinto123 commented 11 years ago

Is there a way to make it download php 5.5 instead of 5.3?

andyshinn commented 11 years ago

The package that gets installed is from the operating system package management. If you want to use PHP 5.5, you need to use the require metaparm to first install a repository having the PHP 5.5 packages (such as http://www.webtatic.com/packages/php55/ if using CentOS).

jacinto123 commented 11 years ago

Can you elaborate a little more on this. I just started using puppet and am not sure what you mean. Would I use the yumrepo? or require it or what.

Thanks for the help

thias commented 11 years ago

This is outside the scope of this module for sure, sorry. As @andyshinn wrote, you'll need to do something else in order to make different php packages available to your nodes, ideally making sure they get installed before any related services are started (which is the dependency @andyshinn mentioned).

kevinmartin commented 10 years ago

Seems like you can also do something like the following:

# site.pp
class php::params {
  $php_package_name = 'php55'
  $php_apc_package_name = 'php55-pecl-apc'
  $common_package_name = 'php55-common'
  $cli_package_name = 'php55-cli'
  $php_conf_dir = '/etc/php.d'
  $fpm_package_name = 'php55-fpm'
  $fpm_service_name = 'php-fpm'
  $fpm_pool_dir = '/etc/php-fpm.d'
  $fpm_conf_dir = '/etc'
  $fpm_error_log = '/var/log/php-fpm/error.log'
  $fpm_pid = '/var/run/php-fpm/php-fpm.pid'
  $httpd_package_name = 'httpd'
  $httpd_service_name = 'httpd'
  $httpd_conf_dir = '/etc/httpd/conf.d'
}

include php::fpm::daemon
php::ini { '/etc/php.ini': }
thias commented 10 years ago

You would probably want to do the above using hiera and the automatic class parameter lookup, something like this (untested) :

---
php::params::php_package_name: 'php55'
php::params::php_apc_package_name: 'php55-pecl-apc'
[...]
wwhurley commented 10 years ago

It appears that settings the php::params needs to be done inside the node configuration and not inside another class. Nor does hiera work directly, unfortunately. What you'd need would be something like:

in your node file

class php::params {
  $php_package_name = $::forumone::php::prefix
  $php_apc_package_name = "${::forumone::php::prefix}-pecl-apc"
  $common_package_name = "${::forumone::php::prefix}-common"
  $cli_package_name = "${::forumone::php::prefix}-cli"
  $php_conf_dir = '/etc/php.d'
  $fpm_package_name = "${::forumone::php::prefix}-fpm"
  $fpm_service_name = 'php-fpm'
  $fpm_pool_dir = '/etc/php-fpm.d'
  $fpm_conf_dir = '/etc'
  $fpm_error_log = '/var/log/php-fpm/error.log'
  $fpm_pid = '/var/run/php-fpm/php-fpm.pid'
  $httpd_package_name = 'httpd'
  $httpd_service_name = 'httpd'
  $httpd_conf_dir = '/etc/httpd/conf.d'
}

And then in hiera:

forumone::php::prefix: "php55"

Of course you'd need to have something like EPEL or another repository that provided PHP 5.5 -- we've used https://forge.puppetlabs.com/stahnma/epel

thias commented 10 years ago

If there's an interest in having the package prefix configurable somehow, I would gladly accept a pull request for a clean change.

For anyone wanting to deploy the latest php on EL, without having to fiddle with a package prefix name and just use the main names, I would really recommend using Remi's packages : http://rpms.famillecollet.com/