There is a problem with installing older PHP versions on new Debian systems. This is a quick tutorial how to do it.
Luckily we can use repositories from Ubuntu and its Launchpad. I use repository from SergeyD.
Select all packages that you want to use - depends on your architecture. For example I use these:
- php53-cli
- php53-common
- php53-fpm
- php53-mod-curl
- php53-mod-gd
- php53-mod-json
- php53-mod-mbstring
- php53-mod-pgsql
- php53-mod-simplexml
- php53-mod-xml
- php53-mod-xsl
Install all packages at once by dpkg.
sudo dpkg -i *.deb
Profit!
Test PHP installation: /usr/bin/php53 -v
I use PHP as FPM so there should be more things to do.
- Edit file
/etc/init.d/php53-fpm
and update variableexec_prefix
(missing/
at the beginning). - Create PHP-FPM pool file. Sample file is located here -
/etc/php53/fpm/pool.d/pool-www-data.conf.example
. You can use sample config file as yours and just rename it. - Enable PHP-FPM service (uncomment it in
/etc/default/php53-fpm
)
I use apache2 as webserver and this is my VirtualHost settings for web running on PHP 5.3.
<VirtualHost *:80>
ServerName web.example.com
DocumentRoot "/var/www/web.example.com"
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/web.example.com
<Directory /var/www/web.example.com>
AllowOverride All
</Directory>
</VirtualHost>