So recently I’ve been working with PHP 5.4 a LOT. Unfortunately Ubuntu (my main dev environment) is behind the times. So I’m resorting to compiling PHP manually.
Not a daunting as it may first appear. The really tricky part is working out your dependencies and configure script.
Hence the reason for this post as a reminder for myself and others that may want to do a quick compile. (I would recommend that if your compiling for a production/live environment that you make sure you understand what it is your compiling though before just using what’s here)
So where to start. Dependencies first I think
Ubuntu allows you to install dependencies for building source apt-get build-deps. We will use this and install any extras we may need.
And now the configure
Once these are done then we follow the standard make process. Notice we are also running make test… very important as it givges more data for the developers to work with.
Make PHP make && make test && make install
1 make && make test && make install
The next thing is configuring your php.ini file as the install doesn’t have one yet so we copy either the production or development default from the source code to the new conf dir and edit to suit your needs.
Shell cp /.ini-(development|production) /usr/local//conf
1 cp /php.ini-(development|production) /usr/local/php/conf
Thats it. All ready to roll… almost, this installation is the one I use for use with a webserver so you will want to add the appropriate directives to apache.
Shell LoadModule php5_module modules/libphp5.so AddHandler php5-script . AddType text/html .
LoadModule php5_module modules/libphp5.so
AddHandler php5-script .php AddType text/html .php