Today we are going to learn about PHP Compilation for Ubuntu. I installed Ubuntu 14.04 and PHP 5.5 came pre-installed with the system but my problem was that I had to make use of ZendOptimizer which supports PHP upto 5.4 only therefore I decided to go manually compile PHP 5.4 and install over Ubuntu.
Step 1 : Install fresh copy of Ubuntu 14.04
Step 2: sudo apt-get update
Step 3: sudo apt-get install build-essential
Step 4: sudo apt-get install openssl libssl-dev openssl-blacklist openssl-blacklist-extra bison autoconf automake libtool re2c flex apache-prefork-dev
Step 4a. sudo apt-get install libxml2-dev libssl-dev libbz2-dev libcurl3-dev libdb5.1-dev libjpeg-dev libpng-dev libXpm-dev libfreetype6-dev libt1-dev libgmp3-dev libc-client-dev libldap2-dev libmcrypt-dev libmhash-dev freetds-dev libz-dev libmysqlclient15-dev ncurses-dev libpcre3-dev unixODBC-dev postgresql-server-dev-9.1 libsqlite-dev libaspell-dev libreadline6-dev librecode-dev libsnmp-dev libtidy-dev libxslt-dev libt1-dev
Step 5: wget http://in1.php.net/distributions/php-5.4.28.tar.bz2
For Step 5 you can use any mirror location for getting the PHP source files which is near to your location.
Step 6: ./configure –with-config-file-path=/etc/php5/apache2 \
Step 7: make
Step 8 make install
Now PHP 5.4.28+ is installed over the server
Note: In order to compile PHP 5.4.28+ on your ubuntu server you will also require to download and build apache2 webserver right from the source instead of using the one supplied by the Ubuntu distribution. This will automatically install apxs2 and will help in the compilation of the PHP. I will be soon posting on method over how to build and install apache2 over Ubuntu