If you provide ISP services for customers that run PHP application on your servers, you might need to run several sides with PHP 5.2 and not with the distributed version from Ubuntu, version 5.3. Searching around the internet, you might find several information on how to install a separate instance. For me, none of the howtos really were suitable. So this little document might help you in installing a cgi version. Here we go…
First of all, you need to install several packages from the Ubuntu repository.
apt-get install build-essential
We build a static PHP version, not using extensions.
apt-get install \
bison chrpath \
These packages are only needed to build anything. Even I did not test it, I am pretty sure, you safely can remove all packages at the end of this how to.
Next get the source code form www.php.net. It it the old stable 5.2.17 as of writing this document.
unpack the code under /usr/local/src or anywhere else (as you prefer).
Change into the directory and issue the following command:
Next do a “make” followed by “make install”. I skipped “make test”. If you feel better, try it 😉
Of course you might wish different features or even use a modular version of PHP. This is just the way, I created a PHP version to suite my needs.
Now you should find the result under /opt/php5.2. In your FastCGI-wrapper, you can specify
exec /opt/php5.2/bin/php-cgi -c "/path/to/php.ini"
End of this little how to. Enjoy!