This question already has an answer here:
-
How To Run PHP From Windows Command Line in WAMPServer
11 answers
I have Wampserver 3.0.6 32 bit installed and it comes with PHP versions 5.6.25 and 7.0.10.
When I switch from 5.6.25 to 7.0.10 from the server tray icon it does not update the actual php version my pc is using.
I can test this with running this in the command prompt: php -v
:
PHP 5.6.25 (cli) (built: Aug 18 2016 11:40:20)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
After restarting wamp services and re opening the terminal multiple times it still shows the same thing.
When I visit localhost in the browser it shows the following:
I'm not sure why its still showing php version 5.6.
Anyone have any ideas?
Running this on Windows 10 64 bit OS.
The version in your terminal and the verison wamp is using may be different.
In a wamp project create a php file and put this in it.
<?php
phpinfo();
?>
Go to the url of the php file in your browser and that will show you the php version the apache server in wamp is using. You can change it using this tutorial.
Changing php version in wamp
Good luck!
When you switch from 5.6.25 to 7.0.10 using the WAMPServer server tray icon it only updates the version of PHP used under Apache.
It does not have any effect on the version of PHP used in the PHP CLI (Command Line Interface).
The simplest way to control the version of PHP used by the CLI is to write a little batch file that will add the correct folder temporarily to the windows PATH for the duration of the command windows existance.
See this answer for how to do that.
NOTE: Avoid adding the php folder to the Windows PATH permanantly. As when you want to use a different version of PHP in the CLI you will forget to amend this, and a batch file like suggested in the other answer is so much more flexible.
UPDATE
As of WAMPServer 3.1.1 there is now a menu item that will change the PHP CLI version to any version of PHP that you have installed as an ADDON.
(right click) wampmanager->Tools->Change PHP CLI Version
BUT
This only changes the version of PHP that the WAMPServer code will use when running its internal PHP based processes. It does not change the PHP CLI version