IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

How to Upgrade to PHP 7.2 on IIS (Windows 10)

This tutorial is a shorter version of the previous post upgrading to PHP 7.1 on Windows 10 and it is intended as a follow-up on how to upgrade your PHP to the latest version (in this case PHP 7.2) if you have already installed the previous version of PHP 7 in your Windows system.

Steps to Upgrade from PHP 7.1 to PHP 7.2

  1. Download PHP for Windows. Since we’re using PHP as FastCGI, we’ll use the 64-bit Non-Thread Safe (NTS) version (i.e., php-7.2.1-nts-Win32-VC15-x64.zip).

  2. PHP 7.2 is also the first version that requires Visual C++ Redistributable for Visual Studio 2017. If you don’t have it installed, you can download it from here (64-bit). If you have a 32-bit OS, please check on the download section below and select the one for x86.

  3. We also need to upgrade our WinCache version for PHP 7.2. Download the WinCache php_wincache-2.0.0.8-7.2-nts-vc15-x64 and extract the file as well.

    WinCache Binary for PHP 7.2

  4. Extract both downloaded zip files (just double-click them and they will be extracted into their sub-folders) as shown below:

    PHP 7.2 and WinCache zip files extracted to sub-folders

  5. If you check the WinCache folder php_wincache-2.0.0.8-7.2-nts-vc15-x64, look for two files with the following names: php_wincache.dll and php_wincache.pdb.

  6. Copy the two files from the WinCache folder to a sub-folder (“ext”) within the PHP folder (i.e., php-7.2.1-nts-Win32-VC15-x64/ext).

    Copy php_wincache files from WinCache folder to ext sub-folder under PHP folder

  7. Now, copy the whole content of php_wincache-2.0.0.8-7.2-nts-vc15-x64 folder into a new folder and name it v7.2.

    Copy all PHP files to a new folder v7.2

  8. Copy the php.ini file from v7.1 to v7.2.

  9. You might want to modify certain parameters in the php.ini as highlighted below:

    [WebPIChanges]
    error_log=C:\WINDOWS\temp\PHP72x64_errors.log
    upload_tmp_dir=C:\WINDOWS\temp
    session.save_path=C:\WINDOWS\temp
    cgi.force_redirect=0
    cgi.fix_pathinfo=1
    fastcgi.impersonate=1
    fastcgi.logging=0
    max_execution_time=300
    date.timezone=Australia/Melbourne
    extension_dir="C:\Program Files\PHP\v7.2\ext\"
    

    And make sure you also have the PHP_WINCACHE set.

    [PHP_WINCACHE]
    extension=php_wincache.dll
    

    The change is pretty simple and we can compare the two php.ini files between v7.1 and v7.2 as below:

    Compare php.ini files between v7.1 and v7.2

  10. Open IIS Manager and click on FastCGI Settings.

    IIS Manager FastCGI Settings

  11. You can create a new entry for PHP 7.2 by following Step 8 from previous post, except for PHPRC where you want to update the value to 7.2 (i.e., C:\Program Files\PHP\v7.2).

    Once completed, just click OK.

    IIS Manager FastCGI Settings Modify PHPRC to version 7.2

  12. Go back to IIS Manager and click on Handler Mappings.

    IIS Manager Handler Mappings

  13. Look for PHP_via_FastCGI and double-click on it. Make sure the path for the Executable is updated accordingly. Click OK when done.

    IIS Manager Handler Mappings PHP_via_FastCGI set to v7.2

Update Windows Environment Variables

Finally, once again we need to update the path of the new PHP in Windows Environment Variables.

  1. Click on the Windows start button and type in “system” and click on System Control panel.

    Windows System Control Panel

  2. In System window, click on Advanced system settings and on System Properties window, make sure you have Advanced tab opened. And you can follow the path shown in the picture to update the path to where your PHP 7.2 is located.

    Control Panel System Environment Variables Update to PHP 7.2

  3. Click on Environment Variables… button.

  4. Under System Variables, click on Path and Edit… button.

  5. Click on where the current PHP is located and double-click it or click on Edit button.

  6. Change the value to the location of the new PHP (i.e., C:\Program Files\PHP\v7.2)

  7. Click OK button on each window to close.

That’s it! Now using the same test.php file with the following code:

<?php phpinfo(); ?>

Run it from your browser (i.e., http://localhost/test.php). If PHP is installed with the correct version, you will see the PHP version will be updated similar to the picture below:

phpinfo 7.2.1 displayed on a page

Further Reading

How to Install PHP on Windows 10 Using Web Platform Installer
FastCGI
Difference between PHP thread safe and non thread safe binaries
Using FastCGI to Host PHP Applications on IIS 7
WinCache Extension for PHP

Download

Download PHP For Windows: Binaries and sources Releases
WinCache 2.0.0.8 PHP Extension Direct Download
Microsoft Visual C++ Redistributable for Visual Studio 2017

January 19, 2018 Filed Under: How To Tagged With: IIS, Internet Information Services, Microsoft, PHP, Windows, Windows 10

Buy me a coffee?

Buy me a coffee If you find any of the articles or demos helpful, please consider supporting my work here, you'll have my big thanks!

Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure