WordPress – Manual update of PHP 7.x on IIS

With Microsoft withdrawing support for PHP in the Web Platform Installer I needed to perform a manual upgrade of PHP on my Windows servers running IIS. There were a few blogs out there but none had all the steps so I thought I’d just jot them all down here so it might help someone in the future.

First thing you’ve got to do is whizz off to the PHP site (LINK) and download the latest release of PHP. Remember to download the Non-Thread Safe version. Now you may think that is enough but one component that is very important for the later versions of PHP 7.x, in my case I was upgrading from 7.3 to 7.4, and that is this release of PHP requires Microsoft Visual C++ 2015-2019 Redistributable installed, without this you’ll get all sorts of error messages (trust me, I’ve been there and go the t-shirt). Download it from HERE.

Ok, so you’ve download the PHP zip and installed Microsoft Visual C++ 2015-2019 Redistributable on to your server.

For my this example my current PHP install is in c:\inetpub\PHP

  • Unzip the PHP zip file into a folder new folder under c:\inetpub, I called it PHP-New
  • Copy the file php.ini-production from this folder to another folder
  • Now go to folder where the live version of PHP is running i.e. c:\inetpub\PHP and copy the php.ini file from here to the same location where you saved the php.ini-production file.
  • Using Notepad++ with the compare plug-in installed (useful blog on how to configure that) and compare both files. Your current PHP.ini is the file you are going to keep so what you’re doing here is checking there aren’t any new settings in the new php.ini-production which need to be copied across. Once you’re happy that any changes have been copied over to your PHP.ini file save the file.
  • Now copy the PHP.ini file you’ve just saved to the new PHP folder i.e. c:\inetpub\PHP-New
  • Open up Internet Information Services manager, select your web server then click on “Stop” from under the “Manage Server” section. This will of course take your website off line so pick a time when this will cause least disruption.
  • With the web site stopped go back to c:\inetpub folder and rename the current PHP folder to PHP-Old and rename PHP-New to PHP. Note: you won’t be able to rename these folders if the webserver is still running, sometimes it might take a minute for the processes to release the lock so don’t panic if you can’t rename them straightaway.
  • Pop back to IIS manager and start the server
  • Check your websites all start up.

If you get any errors you can quickly rollback to the previous version by stopping the IIS server again and swapping around the folder names again

Leave a Reply

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