Goal: Build a PHP 5.3 package, that I can install and upgrade on new ubuntu slices as needed, without having to compile on each box.
This is an amalgamation of different blog posts that did certain things really well, but not everything I wanted. The post I refer to specifically Installing PHP 5.3 on Ubuntu by Brandon Savage .
Prep your system
Setup your development server to be able to compile things. By default, most installations will not come with compilers installed.
apt-get install checkinstall
Say yes, and let it follow the dependencies as needed.
Get the development headers for some of the extensions you’ll be compiling in.
apt-get install postgresql-8.3 postgresql-client-8.3 postgresql-client-common postgresql-common postgresql-server-dev-8.3 aptitude install mysql-client mysql-client-5.0 mysql-common mysql-server mysql-server-5.0 mysql-server-core-5.0 apt-get install libtidy-dev curl libcurl4-openssl-dev libcurl3 libcurl3-gnutls zlib1g zlib1g-dev libxslt1-dev libzip-dev libzip1 libxml2 libsnmp-base libsnmp15 libxml2-dev libsnmp-dev libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev zlib1g zlib1g-dev libfreetype6 libfreetype6-dev libbz2-dev libxpm4-dev libmcrypt-dev libmcrypt4
Download PHP and Compile it
mkdir ~/srcs cd ~/srcs wget http://us3.php.net/get/php-5.3.0.tar.gz/from/this/mirror tar xvfz php-5-3-0.tar.gz cd php-5.3.0
Now, you can either do the ./configure –help and pick your options, or you can use my configure options for PHP 5.3
make make test checkinstall
checkinstall will ask you some basic questions about the package, answer and let it build the package for you. You will run into an interesting issue at first, apxs2 will complain about a LoadModule not being in the httpd.conf file. This is an artifact of how Ubuntu/Debian likes to handle it’s configuration files. The simplest thing is to add a line at the bottom of your httpd.conf that loads a benign module. Mod Pony seems cute .
Configure your PHP like any normal apache server. Reload apache,
put the handy phpinfo(); in your documentroot, and then have
fun.
Be sure to remove the phpinfo(); from your production
servers.
If you want MySQL 5.1, just do apt-get install
mysql-server-5.1 , be sure to change the dev header packages to
the same version as well.