Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wampserver not changing the PHP version [duplicate]

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:

enter image description here

I'm not sure why its still showing php version 5.6.

Anyone have any ideas?

Running this on Windows 10 64 bit OS.

like image 365
user3574492 Avatar asked Aug 29 '17 12:08

user3574492


2 Answers

The version in your terminal and the version 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!

like image 55
Darragh Blake Avatar answered Oct 27 '22 08:10

Darragh Blake


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

like image 22
RiggsFolly Avatar answered Oct 27 '22 07:10

RiggsFolly