Updating PHP in XAMPP for Windows


Inspired by the YAIG blog, here is my how to do it post:

XAMPP is a great suite to quickly get up and running with Apache, PHP, Perl and MySQL. Warning! It is not aimed to be used in a production environment! Its settings are geared towards ease of use rather then security!

However I went against my own advice and used it in a couple of instances, however these are not public facing sites, rather internal and heavily firewalled services. Even so whenever a security update to PHP comes out, I feel the need to use the new version. Here is how you can do it, without waiting for the official XAMPP package to update (you really can’t criticize them for not updating faster, since it is a development not a production server and as such minor PHP releases shouldn’t influence your code).

Warning! Use these instructions on your own risk. They are written to the best of my knowledge, however I can’t make any guarantees. Always backup your data.

  1. Download the latest binary version of PHP (make sure to get the .zip package not the installer)
  2. De-archive it to a directory
  3. Copy the contents of the directory in the php subfolder of your XAMPP installation directory, overwriting the files which are already present
  4. Overwrite the files which are already present in the apachebin directory with the newer versions.
  5. Now the trick: take the files which have a _2 in their names (for example php5apache2_2.dll or php5apache2_2_filter.dll), copy them in the apachebin subdirectory and remove the _2 part, overwriting the existing files. This is necessary because by XAMPP uses Apache version 2.2 and the files with the 2 prefix are built for Apache 2.0, so you must take the files build for the newer version (which has a different plugin interface) and rename them in the filenames XAMPP expects.
,

16 responses to “Updating PHP in XAMPP for Windows”

  1. Thanks for the guide. WIll try out on Monday.
    Have been looking to upgrade my php version for a while.
    Will let you know how it goes!

  2. 4. Overwrite the files which are already present in the apachebin directory with the newer versions.

    newer versions???

  3. thx, it worked. updated XAMPP 1.7.7 from php 5.3.8 to 5.3.14.
    what I done is first backup the original php folder by renaming it, then extract the 5.3.14-VC9 x86 Thread Safe to the re-created php folder. Step 5 is not required to make it work. I also copied the php.ini and php/extras from the backup folder.

Leave a Reply

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