Update PHP Version in IIS
Step 1: Check the Current PHP Version
Open a Command Prompt and run:
Alternatively, create a
phpinfo.php
file in the web root (C:\inetpub\wwwroot\
):
Access it via http://localhost/phpinfo.php
in your browser.
Step 2: Download the Latest PHP Version
Go to the official PHP for Windows site: 🔗 https://windows.php.net/download
Download the latest Non-Thread Safe (NTS) x64 ZIP file (for IIS).
Step 3: Backup the Existing PHP Installation
Navigate to your current PHP installation directory (e.g.,
C:\PHP
orC:\Program Files\PHP
).Create a backup by copying the folder to a safe location.
Step 4: Extract and Configure PHP
Extract the downloaded ZIP file to a new directory, e.g.,
C:\PHP8
.Copy the
php.ini-development
file and rename it tophp.ini
.Open
php.ini
and configure necessary settings likeextension_dir
:
Update any required extensions by uncommenting lines (remove
;
):
Step 5: Update IIS to Use the New PHP Version
Option 1: Update in IIS Manager
Open IIS Manager (
inetmgr
).Go to Handler Mappings.
Find
*.php
, and double-click it.Change the Executable Path to the new PHP location (
C:\PHP8\php-cgi.exe
).Click OK, then restart IIS.
Option 2: Update FastCGI in fcgi
Settings
Open Command Prompt as Administrator.
Run the following command to update FastCGI settings:
Step 6: Update System PATH Variable
Open System Properties → Advanced → Environment Variables.
In System Variables, find Path and edit it.
Replace the old PHP path with the new one (
C:\PHP8
).Click OK and restart the server.
Step 7: Restart IIS and Verify
Restart IIS:
Run:
Or refresh http://localhost/phpinfo.php
to confirm the new version.
REFERENCES
Last updated
Was this helpful?