Back to Top

Sunday, July 29, 2007

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 apache\bin 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 apache\bin 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 comments:

  1. :)

    Whoa! Thanks for the link!

    ReplyDelete
  2. 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!

    ReplyDelete
  3. Anonymous2:32 AM

    N?A

    ReplyDelete
  4. @Anonymous: I would be glad to help you out if you could elaborate a little more your question.

    ReplyDelete
  5. Anonymous12:14 AM

    It works! Congratulations, it really helped me!

    ReplyDelete
  6. Anonymous12:26 PM

    4. Overwrite the files which are already present in the apache\bin directory with the newer versions.

    newer versions???

    ReplyDelete
  7. @Anonymous: I'm referring to files like php5apache.dll.

    ReplyDelete
  8. Eugen8:59 AM

    works like a fortune

    ReplyDelete
  9. Hi, thanks for the guide. Although the post is quite outdated but I hope I can use it to upgrade my PHP to version 5.3.6.
    Thanks again. :)

    ReplyDelete
  10. @bitra: hopefully it works - either way, if you have a little time, please let me know how it went.

    ReplyDelete
  11. Kevin4:19 PM

    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.

    ReplyDelete
  12. Hey can anyone tell me if this works on apache-php or not? i have do it....., but on my server around 20 people works, so i cant take any wrong step.

    ReplyDelete
  13. Can anybody help me to downgrade from 5.4 to 5.3 version of php in xampp windows platform

    ReplyDelete
  14. @Sha - why would you want to downgrade?

    ReplyDelete
  15. how can i upgrade my XAMPP for Windows without any backup

    ReplyDelete