How to install lamp server with php 5.3 on ubuntu 16.04?

5,555

In case you really need to do it, use phpbrew.

My steps to install php5.3 on Ubuntu 16.04 (will work for 14.04):

Install phpbrew https://github.com/phpbrew/phpbrew/wiki/Quick-Start

To build 5.3.24 :

sudo phpbrew install 5.3.24  +bz2 +calendar +cli +gd +ctype +dom +iconv +fileinfo +filter +ipc +json +mbregex +mbstring +mhash +mcrypt +pcntl +pcre +pdo +phar +posix +readline +sockets +tokenizer +xml +curl +zip +mysql +debug +apxs2

/etc/apache2/mods-available/php5.load file must contain

LoadModule php5_module        /usr/lib/apache2/modules/libphp5.3.24.so
AddType application/x-httpd-php .php

To enable module for apache2:

sudo a2dismod php5.6 ; sudo a2dismod php7.0 ; sudo a2enmod php5 ; sudo service apache2 restart

To install gd extension

phpbrew use php5.3.24
phpbrew ext install gd --with-gd=shared,/usr --enable-gd-native-ttf --with-gmp=shared,/usr --with-jpeg-dir=shared,/usr --with-xpm-dir=shared,/usr/X11R6 --with-png-dir=shared,/usr --with-freetype-dir=shared,/usr --with-vpx-dir=shared,/usr
Share:
5,555

Related videos on Youtube

Rakesh Mali
Author by

Rakesh Mali

Updated on September 18, 2022

Comments

  • Rakesh Mali
    Rakesh Mali over 1 year

    Is it possible to successful run php5.3 on ubuntu 16.04 or not? I have an PHP application that required only php 5.3 version.

    1. Please let me know what version of ubuntu is required to run PHP 5.3
    2. How can I install lamp server with php 5.3 and all its dependent modules (apache server mysql etc)
    • muru
      muru almost 7 years
      PHP 5.3 is EOL. Nobody packages it. You'll have to install from source.
    • Rakesh Mali
      Rakesh Mali almost 7 years
      Do you know any references for this? if yes, please share...
  • sempaiscuba
    sempaiscuba over 6 years
    It's generally better to include those steps here in your answer, rather than including a link.