Recently i faced with a case when i need to run an old website which requires PHP 5.2 when my main version on the test server is 5.3.5
Debian Squeeze 6.0
Here i place a very short step by step instruction for how to do so.
1. Go to http://us3.php.net/downloads.php and download needed php version.
2. Extract just downloaded file: shell> tar xzvf php-5.2.17.tar.gz
3. Install PHP development libraries:
shell> apt-get update
shell> apt-get install libxml2-dev libmysqlclient-dev libcurl4-gnutls-dev libcurl4-openssl-dev libpng12-dev libjpeg62-dev
4. go to the folder where you extracted PHP archive
5. configure and make it:
shell> ./configure --prefix=/opt/php5.2 \
shell> make install
6. Install and set up fastcgi support for PHP:
shell> apt-get install libapache2-mod-fastcgi
7. Enable fastcgi:
shell> a2enmod fastcgi
8. Enable mod_actions:
shell> a2enmod actions
9. Set up PHP cgi wrapper. Create file '/usr/lib/cgi-bin/php52-cgi' with the following content:
10. Make this file executable:
shell> chmod +x /usr/lib/cgi-bin/php5-cgi
11. Create include file for Virtual Hosts: '/etc/apache2/php52.conf'
12. Fill it in with the following content:
#include for virtual hosts that need to run php-5.2
ScriptAlias /php52-cgi /usr/lib/cgi-bin/php52-cgi
Action application/x-httpd-php5 /php52-cgi
AddHandler application/x-httpd-php5 .php
13. copy php.ini-recommended file to /opt/php5.2/ and rename it to php.ini
14. Include this file in to Virtual Hosts, where PHP2 is needed.
#needs to run version 5.2.x of PHP
15. Restart Apache: /etc/init.d/apache2 restart
That is it.
Thanks to Brett's blog!
Also I invite you to visit us at www.mbi-solutions.net