How to install php5 in Ubuntu 9.04

This is a guide on how to install php5 in Ubuntu 9.04 using command line. We are using apt-get package management system to install the package. It is pretty simple, straight forward instructions. There are only two important things to do here, install php5 and remove all packages that are no longer required. Here are all the steps you need:

Install php5 using apt-get command:

root@kkcjlab-server:~# apt-get install php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libsm-dev libice-dev libqt4-assistant x11proto-xext-dev libatk1.0-dev
  debhelper libaudio-dev intltool-debian x11proto-kb-dev libglib2.0-dev
  libdjvulibre-dev libjasper-dev x11proto-xinerama-dev libpango1.0-dev
  libqt4-test x11proto-render-dev libxi-dev libxmu-headers libxrender-dev
  po-debconf libflac++6 libqt4-opengl-dev libgraphviz-dev libcairo2-dev
  mesa-common-dev libxdmcp-dev libsysfs-dev libdirectfb-extra libglu1-xorg-dev
  libsqlite0-dev libfontconfig1-dev libmail-sendmail-perl libdirectfb-dev
  x11proto-composite-dev xtrans-dev libtool libqt4-xmlpatterns libqt4-dev
  libmagickwand-dev x11proto-core-dev libxcursor-dev gettext libqt4-help
  libexif-dev libglu1-mesa-dev x11proto-randr-dev x11proto-damage-dev
  autotools-dev libxcb-render-util0-dev qt4-qmake libxt-dev libgtk2.0-dev
  libxmu-dev libxext-dev libxdamage-dev libmagickcore-dev libmagick++-dev
  libwmf-dev libxml2-dev x11proto-input-dev libltdl7-dev libfreetype6-dev
  libqt4-svg x11proto-fixes-dev libpthread-stubs0-dev xlibmesa-gl-dev
  libmagick++1 libxau-dev libpthread-stubs0 libxcomposite-dev libgl1-mesa-dev
  liblcms1-dev libxrandr-dev libexpat1-dev librsvg2-dev html2text
  libpixman-1-dev libxft-dev libx11-dev libopenexr-dev libxcb-render0-dev
  libxfixes-dev libmng-dev libxcb1-dev libqt4-scripttools libxinerama-dev
  libsys-hostname-long-perl libbz2-dev libilmbase-dev
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  php5
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1060B of archives.
After this operation, 0B of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  php5
Install these packages without verification [y/N]?

You can press Y and enter now to install php5 but in this tutorial, we are going to remove all packages that are no longer required first, so press N to stop the installation.

We can use apt-get autoremove packages command to remove all packages that no longer required. Just select the first package and remove it as in the example below:

root@kkcjlab-server:~# apt-get autoremove libsm-dev libice-dev libqt4-assistant x11proto-xext-dev libatk1.0-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  debhelper libaudio-dev intltool-debian x11proto-kb-dev libglib2.0-dev
  libdjvulibre-dev libjasper-dev x11proto-xinerama-dev libqt4-test
  x11proto-render-dev libxmu-headers libxrender-dev po-debconf libflac++6
  libgraphviz-dev mesa-common-dev libxdmcp-dev libsysfs-dev libdirectfb-extra
  libglu1-xorg-dev libsqlite0-dev libfontconfig1-dev libmail-sendmail-perl
  xtrans-dev libtool libqt4-xmlpatterns x11proto-core-dev gettext libqt4-help
  libexif-dev libglu1-mesa-dev x11proto-randr-dev autotools-dev
  libxcb-render-util0-dev qt4-qmake libxml2-dev x11proto-input-dev
  libltdl7-dev libfreetype6-dev libqt4-svg libpthread-stubs0-dev
  xlibmesa-gl-dev libmagick++1 libxau-dev libpthread-stubs0 libgl1-mesa-dev
  liblcms1-dev libexpat1-dev html2text libpixman-1-dev libxft-dev libx11-dev
  libopenexr-dev libxcb-render0-dev libmng-dev libxcb1-dev libqt4-scripttools
  libsys-hostname-long-perl libbz2-dev libilmbase-dev
The following packages will be REMOVED:
  autotools-dev debhelper gettext html2text intltool-debian libatk1.0-dev
  libaudio-dev libbz2-dev libcairo2-dev libdirectfb-dev libdirectfb-extra
  libdjvulibre-dev libexif-dev libexpat1-dev libflac++6 libfontconfig1-dev
  libfreetype6-dev libgl1-mesa-dev libglib2.0-dev libglu1-mesa-dev
  libglu1-xorg-dev libgraphviz-dev libgtk2.0-dev libice-dev libilmbase-dev
  libjasper-dev liblcms1-dev libltdl7-dev libmagick++-dev libmagick++1
  libmagickcore-dev libmagickwand-dev libmail-sendmail-perl libmng-dev
  libopenexr-dev libpango1.0-dev libpixman-1-dev libpthread-stubs0
  libpthread-stubs0-dev libqt4-assistant libqt4-dev libqt4-help
  libqt4-opengl-dev libqt4-scripttools libqt4-svg libqt4-test
  libqt4-xmlpatterns librsvg2-dev libsm-dev libsqlite0-dev
  libsys-hostname-long-perl libsysfs-dev libtool libwmf-dev libx11-dev
  libxau-dev libxcb-render-util0-dev libxcb-render0-dev libxcb1-dev
  libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev
  libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxml2-dev libxmu-dev
  libxmu-headers libxrandr-dev libxrender-dev libxt-dev mesa-common-dev
  po-debconf qt4-qmake x11proto-composite-dev x11proto-core-dev
  x11proto-damage-dev x11proto-fixes-dev x11proto-input-dev x11proto-kb-dev
  x11proto-randr-dev x11proto-render-dev x11proto-xext-dev
  x11proto-xinerama-dev xlibmesa-gl-dev xtrans-dev
0 upgraded, 0 newly installed, 89 to remove and 0 not upgraded.
After this operation, 117MB disk space will be freed.
Do you want to continue [Y/n]? 

Now we can continue installing php5:

root@kkcjlab-server:~# apt-get install php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  php5
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1060B of archives.
After this operation, 0B of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  php5
Install these packages without verification [y/N]? 

Press Y and Enter to install php5.

Install these packages without verification [y/N]? Y
Get:1 http://packages.dotdeb.org stable/all php5 5.2.13-0.dotdeb.1 [1060B]
Fetched 1060B in 0s (1154B/s)                       
Selecting previously deselected package php5.
(Reading database ... 198455 files and directories currently installed.)
Unpacking php5 (from .../php5_5.2.13-0.dotdeb.1_all.deb) ...
Setting up php5 (5.2.13-0.dotdeb.1) ...
root@kkcjlab-server:~# 

That's all. Now you have php5 installed in your Ubuntu system.