20 Jan 2013

Updating to a new Version of PHP in XAMPP (Windows)

Still working on on old version of pHp, due to an old install of XAMPP? Hmm, I was too until I realised that some functions just didn't work. In my case it was the DateTime object and its failure to calculate the difference in the number of days between two dates. On further investigation, I realised that I had to have the VC9 build as opposed to the old and knackered VC6. Okay, armed with that info I sought to update pHp. Hmm (again) - didn't seem to be an easy way to do it, although I found a few references, it all looked a bit daunting. I didn't want to get caught up with pHp's binaries, so a I was looking at a fresh install of XAMPP. This actually proved to be far less of a problem than I thought, although it did take a little while. Here goes:
  1. Back up your data folders and virtual hosts file (assuming that XAMPP is installed in root):
    • C:\xampp\htdocs
    • C:\xampp\mysql\data
    • C:\xampp\apache\conf\extra\httpd-vhosts.conf
  2. It may be worth making a backup of your php.ini file too, just to check that you have the same configuration - although, don't just blindly use the old version as there may be differences.
  3. Once you've backed up all the important stuff, uninstall XAMPP. XAMPP comes with its own uninstaller, so use that. It may ask you if you need to keep htdocs and mysql data, but you can now safely answer no to those.
  4. Once uninstalled, hop over to the XAMPP site and download the version of your choice.
  5. Install XAMPP and copy over the htdocs and mysql data files to the new directories and then reinstate your virtual hosts in the httpd-vhosts.conf file. Ensure that the paths in that file are the same as the new installation. For example:
    NameVirtualHost *:80
        <VirtualHost *:80>
            DocumentRoot "C:/xampp/htdocs"
            ServerName localhost
        <VirtualHost *:80>
            DocumentRoot "C:/xampp/htdocs/grapenun"
            ServerName grapenun.local
            <Directory "C:/xampp/htdocs/grapenun">
              Order allow,deny
              Allow from all
    If your new xampp installation is not at C:/xampp/, then you'll need to change all the references in the file.
  6. Fire up the XAMPP control panel - it may look different to the old panel - and start Apache and MySQL. Be patient - Apache sometimes has a little think about it before telling you it's started!

1 comment:

  1. Interesting Post! Thank you for sharing the recent technological updates.
    PHP Training in Chennai|PHP Course in Chennai