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 http://us2.php.net/get/php-5.4.24.tar.bz2/from/us1.php.net/mirror
  tar xjf php-5.4.24.tar.bz2
  cd php-5.4.24
  ./configure --prefix=$PWD/installdir --enable-bcmath --with-mysql
  make install
  cd -

At this point php-cgi (the binary used by the PHP SDK) can be found in

php-5.4.24/installdir/bin/php-cgi

.

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

/opt/php-5.4.24/installdir/bin/php-cgi

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,

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

Sources:
https://developers.google.com/appengine/docs/php/gettingstarted/installinglinux#PHP

http://stackoverflow.com/questions/15296103/how-to-install-php-5-4-without-overwriting-existing-older-php-version

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, or virtu...
  • Create swap partition on Ubuntu To create a swap partition after an Ubuntu installation create an empty partition that should have no holes. You can then format this partition with sudo mkswap /dev/sdx replacing sdx with yo...
  • Installing Ubuntu 12.04 LTS on a XenServer VM The following steps can be taken to install Ubuntu 12.04 LTS on a VM running on XenServer 6. Unfortunately there is no standard template for Ubuntu 12.04 (at least in XenServer 6.0.2 which I u...
  • 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 method func...
  • Install Nemo File Manager in Ubuntu 13.04 Raring/12.10 Quantal Nemo is a complete fork of Nautilus and its goal is to extend the Cinnamon user experience to desktop and file management. Nemo has features like: compact view, all desktop icons, etc.. which are m...
This entry was posted in Linux and tagged , . Bookmark the permalink.

3 Responses to Install PHP 5.4 as standalone

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>