In command prompt type below
set PATH=%PATH%;C:\path\to\php
Where C:\path\to\php is the folder where your php.exe file is located. After this run
C:\>php -v
than you will see something like
PHP 7.3.6 (cli) (built: May 29 2019 12:11:00)
UPDATE:
If you find that when you restart your computer, this solution will not work anymore:
Set the Path like as following:
Step 1 - Click on the
Windowsicon

Step 2 - Click on the
Settingsicon

Step 3 - Click on
System

Step 4 - Click on
About

Step 5 - Click on
System info

Step 6 - Click on
Advanced system settings

Step 7 - Click on
Environment variables...

Step 8 - Select
Pathrow and then clickEdit

Step 9 - Click
Newand then clickBrowse, then in the next panel which will open you need to select the folder you want in thePath. For the initial premise of this guide i will add the folderC:\Users\NewFolderInPathNote: Replace your PHP installed path(e.g:
C:\Program Files\php) with the above path .

Step 10 - Click
OKand click everyOKbutton you will encounter to close every previous windows.

In command prompt type below
set PATH=%PATH%;C:\path\to\php
Where C:\path\to\php is the folder where your php.exe file is located. After this run
C:\>php -v
than you will see something like
PHP 7.3.6 (cli) (built: May 29 2019 12:11:00)
UPDATE:
If you find that when you restart your computer, this solution will not work anymore:
Set the Path like as following:
Step 1 - Click on the
Windowsicon

Step 2 - Click on the
Settingsicon

Step 3 - Click on
System

Step 4 - Click on
About

Step 5 - Click on
System info

Step 6 - Click on
Advanced system settings

Step 7 - Click on
Environment variables...

Step 8 - Select
Pathrow and then clickEdit

Step 9 - Click
Newand then clickBrowse, then in the next panel which will open you need to select the folder you want in thePath. For the initial premise of this guide i will add the folderC:\Users\NewFolderInPathNote: Replace your PHP installed path(e.g:
C:\Program Files\php) with the above path .

Step 10 - Click
OKand click everyOKbutton you will encounter to close every previous windows.

In command prompt type below
set PATH=%PATH%;C:\path\to\php
Where C:\path\to\php is the folder where your php.exe file is located. After this run
C:\>php -v
than you will see something like
PHP 7.3.6 (cli) (built: May 29 2019 12:11:00)
UPDATE:
If you find that when you restart your computer, this solution will not work anymore:
Set the Path like as following:
Step 1 - Click on the
Windowsicon

Step 2 - Click on the
Settingsicon

Step 3 - Click on
System

Step 4 - Click on
About

Step 5 - Click on
System info

Step 6 - Click on
Advanced system settings

Step 7 - Click on
Environment variables...

Step 8 - Select
Pathrow and then clickEdit

Step 9 - Click
Newand then clickBrowse, then in the next panel which will open you need to select the folder you want in thePath. For the initial premise of this guide i will add the folderC:\Users\NewFolderInPathNote: Replace your PHP installed path(e.g:
C:\Program Files\php) with the above path .

Step 10 - Click
OKand click everyOKbutton you will encounter to close every previous windows.

You just need to find out where is your PHP folder.
- If you are using XAMPP or WAMP then you will see a php folder.
- You just need to go into the php folder using your cmd using command
cd \xampp\php (FOR XAMPP)
cd \wamp\php (FOR WAMP)
- And then just type in this command
php -v
- Then you will see something like
PHP 5.6.11 (cli) (built: Jul 9 2015 20:55:40) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
Updating PHP on Windows servers
How to check PHP version?
PHP on IIS Server 2019 - How do I update it?
PHP version in Windows hosting - Web Hosting Technical Support Discussion Forum
Videos
PHP is a scripting language that commonly has been used to implement a content management systems. It is my recommendation that you move anything that is dependent on PHP to a Linux machine. Microsoft ended their support and involvement of PHP about 5 years ago and at php 8.0. If you want to do like I do, utilize the tools on the system to manage the PHP installations (phpmanager and Windows Platform Installer) you can no longer do that. The infrastructure for both of those are gone (iis.net). Since PHP is an open source project, you can go directly there and get what you want, but you have also now acquired the resposibility for doing it yourself.
On top of that with the age of these servers, you have to also assess the applications that are using PHP. The upgrade from 5.6 to 8.2 isn’t likely to be smooth. Something built for 5.6 is far from being compatible with 8.x You have at least the step from version 5 to 7 and 7 to 8 to consider.
I’ve just inherited some customer facing web servers and have been asked by the security team to update PHP on them, as they are “slightly” out of date.
I’ve never had anything to do with PHP before, have no idea what it is, how it works or anything… and I am looking for some straightforward guidelines to updating it while ensuring that our customer sites are not affected in anyway…
Has anyone got any pointers?
They’re 2 x Windows Server 2012 R2 and 1 x 2016. The 2012R2s have PHP version 5.6.31 and the 2016 has version 7, and we use IIS.
hi, I'm new to PHP.
I want to change display_errors to On for debugging, but see many PHP versions installed.
I thought going to http://localhost/first/index.php?language=English&page=phpinfo would give me the version , but it just renders the regular index page.
Ty.
Hi @XR220 ,
I suggest you install php manager in IIS. It can help you manage different versions of php and it is simpler to add new php than configure fastcgi manually. Download it from here.
Please download php from this link and choose the zip:
Please put all php folders in C:\Program Files (x86)\PHP for ease of management. (Web PI also install php in this folder)
- Click php manager to register new php version.
- Choose the php-cgi.exe of php 7.3.31 and OK.
- Click Change php version to check which version of php is using now.
- Then click Check php info and OK, it will output the version of php.
If it doesn't output php version correctly and show error that fastcgi exited unexpectedly, you can use command line to run php-cgi.exe. It will tell you why php run failed. When I tested php 7.3.31, it ran failed because VCRUNTIME140.dll is missing. If you have same issue, please download it from here. Choose the x64 or x86 according to your machine.
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Bruce Zhang
Hi there, Our intranet sites webserver is curretly using PHP version 7.4.21 and I'm trying to update it to 8.4.12.
I've installed the new version in the web server and saved it in the same PHP folder where the older version was installed.
After that I opened up IIS manager > webserver > Fast CGI settings and created a new fastcgi application with new php version folder path.
Expanded sites and clicked on one of the intranet site
Selected Handler mapping and updated the .php file with new path
Saved and restarted the webserver but the website gives error 505 with the new version. If I change the fastcgi application back to the older version the site works again.
Can someone please help me or let me know if I'm missing anything or suggest something? Thanks!
If you are using the PHP CLI, then try using theese shell commands (i'm assuming that you are using linux here)
which php - will locate the php executable (this should be the default php used by you)
whereis php - The first path displayed will be the location of the php executable
echo $PATH - will print a list of paths separated by ":" where the system looks for commands
If you are using PHP as an Apache module then phpinfo() will tell you the php version used, and the php config files, NOT the php path. If you have 2 versions of the php executable then this will help you. If they are the same version then it wont really matter which one is who:)
If you want to find out the php version, then php -v will print the php version in the CLI and any Zend modules installed.
If you want to find out the ini files included then php --ini will display th list of ini files loaded by the php module (this applies for the CLI version).
Just add a simple script
<?php phpinfo(); ?>