Skip to content

Instantly share code, notes, and snippets.

@gergoerdosi
Created February 19, 2013 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gergoerdosi/4990967 to your computer and use it in GitHub Desktop.
Save gergoerdosi/4990967 to your computer and use it in GitHub Desktop.
class php::install {
package { 'build-essential':
ensure => installed,
}
package { [ 'libxml2-dev', 'libpcre3-dev', 'libbz2-dev', 'libcurl4-openssl-dev', 'libjpeg-dev', 'libpng12-dev', 'libxpm-dev', 'libfreetype6-dev', 'libmysqlclient-dev', 'libt1-dev', 'libgd2-xpm-dev', 'libgmp-dev', 'libsasl2-dev', 'libmhash-dev', 'freetds-dev', 'libpspell-dev', 'libsnmp-dev', 'libtidy-dev', 'libxslt1-dev', 'libmcrypt-dev' ]:
ensure => installed,
}
define source(
$version = $title
) {
include php::params
exec { "download-${version}":
cwd => '/tmp',
command => "wget -O php-${version}.tar.gz ${php::params::url}",
creates => "/tmp/php-${version}.tar.gz",
timeout => 3600,
logoutput => 'on_failure',
}
exec { "extract-${version}":
cwd => '/tmp',
command => "tar -xzf php-${version}.tar.gz -C /usr/src",
logoutput => true,
creates => "/usr/src/php-${version}",
require => Exec["download-${version}"],
}
exec { "configure-${version}":
cwd => "/usr/src/php-${version}",
command => "./configure $php::params::configure",
path => [ "/usr/src/php-${version}", '/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/' ],
timeout => 0,
logoutput => 'on_failure',
require => [ Exec["extract-${version}"], Package['build-essential'], Package['libxml2-dev'], Package['libpcre3-dev'], Package['libbz2-dev'], Package['libcurl4-openssl-dev'], Package['libjpeg-dev'], Package['libpng12-dev'], Package['libxpm-dev'], Package['libfreetype6-dev'], Package['libmysqlclient-dev'], Package['libt1-dev'], Package['libgd2-xpm-dev'], Package['libgmp-dev'], Package['libsasl2-dev'], Package['libmhash-dev'], Package['freetds-dev'], Package['libpspell-dev'], Package['libsnmp-dev'], Package['libtidy-dev'], Package['libxslt1-dev'], Package['libmcrypt-dev'] ],
}
exec { "make-${version}":
cwd => "/usr/src/php-${version}",
command => "make",
timeout => 0,
logoutput => 'on_failure',
require => Exec["configure-${version}"],
}
exec { "make-install-${version}":
cwd => "/usr/src/php-${version}",
command => "make install",
timeout => 0,
logoutput => 'on_failure',
require => Exec["make-${version}"],
}
}
php::install::source { '5.3.21': }
php::install::source { '5.4.11': }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment