PHP 5.5 on Oracle VirtualBox

PHP 5.5 has added a nice support for Generators, which I’ll cover in some other post. I needed to test these new features and add some to old applications. However PHP has dropped support for Windows XP and Windows 2003 starting with PHP 5.5. and I still have a Windows XP machine (along with Ubuntu 14.0 LTS). Although I could install PHP 5.5 in Ubuntu, most of the time I’m using Windows. I decided to go with VirtualBox for installing PHP 5.5, as I have some legacy PHP applications that I want to upgrade to the new version, and VirtualBox makes it easier to switch between operating systems.

Installing VirtualBox

Oracle VirtualBox is a relatively small full featured virtualizer for x86 hardware. Installing is a painless process. I would suggest reading some tutorials on installing Linux on VirtualBox.

Initially I went on installing Ubuntu 14.04 from a bootalbe CD, but the Unity desktop really dragged down the response time on VirtualBox. As I needed only support for PHP 5.5 and above I decided to go with Lubuntu, a fast and lightweight operating system.

While creating a virtual hard disk in VirtualBox make sure you used the ‘fixed’ disk option rather than ‘dynamic’. Although this takes time during the initial creation, it is usually faster later. Also make sure you use a disk size of at least 9 GB.

Installing PHP 5.5

Once you have Linux installed on VirtualBox it is time to install PHP 5.5.

1. Add the following repository to your system.

sudo add-apt-repository ppa:ondrej/php5

2. Update.

sudo apt-get update

3. Install PHP

sudo apt-get install php5

4. Check the installed version of PHP via.

php5 -v

It is possible to update from any PHP version to the latest one with exactly the commands above. But, after doing

sudo apt-get install php5

you’ll have to restart the server with

sudo /etc/init.d/apache2 restart
sudo service apache2 restart

One thought to “PHP 5.5 on Oracle VirtualBox”

  1. Nice, thanks for posting.

    Would suggest sticking with php 5.5- I’ve been struggling trying to [re]learn the OO bits and 5.6.10 update broke the graph data structure stuff I’d been trying out.

    All of it courtesy of your “Building a Graph data structure in PHP” post. Another thanks for sharing that one as well.

Leave a Reply

Your email address will not be published.