Install PHP 5.4 as standalone

PHP 5.4 is not packaged on most Linux distributions so it may be easiest to install it from source. On Debian-based Linux systems, you can use the following commands to install PHP 5.4 in such a way that it won’t effect any other versions of PHP that you may have installed:

  sudo apt-get install gcc libmysqlclient-dev libxml2-dev
  wget --trust-server-names
  tar xjf php-5.4.24.tar.bz2
  cd php-5.4.24
  ./configure --prefix=$PWD/installdir --enable-bcmath --with-mysql
  make install
  cd -


--with-mysqli=mysqlnd --with-pdo-mysql=mysqlndphp-cgi

the binary used by the PHP SDK can be found in



You can switch to the following folder, for the best pracice


Then add to apache config file (/etc/apache2/http.conf)

ScriptAlias /php54-cgi /opt/php-5.4.24/installdir/bin/php-cgi/
Action application/x-httpd-php54 /php54-cgi

In desired virtual machine,

  <FilesMatch "\.php">
    SetHandler application/x-httpd-php54


Be Sociable, Share!

Related Posts

  • How To Install nginx on Ubuntu / Virtualmin Nginx is a lightweight webserver that supports most of the functionality of Apache, but is faster and uses less memory. It is suited to websites that have a large amount of static content, […]
  • HowTo: Save A File In Vim / Vi Without Root Permission This happens lot of times. I login as a normal user and start to edit httpd.conf or lighttpd.conf or named.conf in vim / vi text editor. However, I'm not able to save changes due to […]
  • PostgreSQL function call model for PHP This article describes a simple class that can be used to call PostgreSQL functions. Using the class has a number of advantages: PostgreSQL functions can be called like they are PHP […]
This entry was posted in Linux and tagged , . Bookmark the permalink.

4 Responses to Install PHP 5.4 as standalone

  1. Dragoslav says:

    I 5.3 je sasvim dovoljan ..

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>