Update PHP Version in IIS
Last updated
Was this helpful?
Last updated
Was this helpful?
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.
Go to the official PHP for Windows site: 🔗
Download the latest Non-Thread Safe (NTS) x64 ZIP file (for IIS).
Navigate to your current PHP installation directory (e.g., C:\PHP
or C:\Program Files\PHP
).
Create a backup by copying the folder to a safe location.
Extract the downloaded ZIP file to a new directory, e.g., C:\PHP8
.
Copy the php.ini-development
file and rename it to php.ini
.
Open php.ini
and configure necessary settings like extension_dir
:
Update any required extensions by uncommenting lines (remove ;
):
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:
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.
Restart IIS:
Run:
Or refresh http://localhost/phpinfo.php
to confirm the new version.