1

I have WampServer Version 3.1.4 64bit installed on Windows 7 and it comes with PHP versions php5.6.38, php7.0.32, php7.1.22, and php7.2.10. I would like to use php5.6.x rather than php7.x.

So, when I switch from php7.2.10 to php5.6.38 from the server tray icon; it does not update the actual php version which is shown by phpinfo(). On localhost, it still says:

PHP Version: 7.2.10

However, it is updated on CLI side. This is tested with running this in the cmd:

php -v

The result is :

c:\wamp64\bin\apache\apache2.4.35\bin>php -v
PHP 5.6.38 (cli) (built: Sep 13 2018 12:45:08)
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, and restarting computer, it still not updated through phpinfo. It probably related the php version used by Apache service. How can I change this to 5.6.x Any suggestions ? Many thanks

Note : The issue is not related with changing php cli version as it was pointed here. I do not understand why some of them insist that this is potential duplication without reading the post carefully.

ozturkib
  • 1,493
  • 16
  • 28
  • https://superuser.com/questions/969861/phpinfo-and-php-v-shows-different-version-of-php – Dharman Jan 01 '19 at 00:20
  • Possible duplicate of [Wampserver not changing the PHP version](https://stackoverflow.com/questions/45939111/wampserver-not-changing-the-php-version) – Dharman Jan 01 '19 at 00:22
  • @Dharman it is not duplicaion at all! If you read both questions carefully, you will see that the one you showed can not change CLI version for php. This is not the case in the question as it is specifically indicated inside the parenthesis. – ozturkib Jan 01 '19 at 00:33
  • @Dharman Once again you have not read the question at all. phpinfo() and php -v are showing the same thing unlike your link. So your both comments are does not related with question at all. – ozturkib Jan 01 '19 at 00:35
  • Just trying to help. It did seem to me to be related to your question. BTW why are you trying to downgrade your PHP version? Is this for an existing project which was written in PHP 5? – Dharman Jan 01 '19 at 00:48
  • @Dharman No problems. Exactly because of existing project. The running server has already 5.x version which I am not able to upgrade it as well – ozturkib Jan 01 '19 at 01:21
  • This is really contraintuitive. In WAMPServer the PHP version used by the CLI is NEVER SET i.e. WAMPServer NEVER amends the windows PATH to add ANY of the possible PHP versions to the PATH – RiggsFolly Jan 01 '19 at 14:18
  • First suggestion - Did you install ALL of the MSVC Runtimes suggested in the first Dialog you see in the install? That is BOTH 32bit AND 64bit MSVC Runtimes?? – RiggsFolly Jan 01 '19 at 14:18
  • @RiggsFolly How can you sure that WAMPServer cannot modify PHP version ? If this is the case, why there is settings on the server tray icon related with changing PHP version for CLI ? There are also third party solutions to change it on WAMP server; however it does not work in my side. But I do not understand why you are saying like that ? (Example : https://github.com/midnight-coding/WampServer-PHP-CLI-Version-Changer) – ozturkib Jan 01 '19 at 16:48
  • @RiggsFolly I think I have installed all recommended ones during installation but not entirely sure what you are pointing specifically. Is there any way to check them on an installed case ? – ozturkib Jan 01 '19 at 17:26

3 Answers3

8

I have faced kind of similar issue, I have installed wampserver upgrades from https://wampserver.aviatechno.net/?lang=en. I needed php 7.3 and 7.4, after installing the php upgrades, those new versions were not being reflected in wampserver traymenu (left click on wamp icon->php-versions). After spending quite some time looking into this, finally could fix this by following steps :

Clearing logs (right click on wampserver icon -> tools -> empty logs) [my php log file was 300+ MB].

Restarted wampserver and it was good to go.

I found solution from this thread http://forum.wampserver.com/read.php?2,159184

Neo
  • 523
  • 7
  • 15
3

(TL:DR) Use left click -(instead of right click)- menu to change PHP versions.

(Long explanation) Hi, this happened to me today. I was trying to change the php version from 7.2 to 5.6 to test something. However, Wampserver was not changing the web version of php. After much searching in the web and noticing in certain videos that some people were getting a different menu than me in the wamp server icon, I realised that there is a whole left click menu in wampserver in which you can change the php version and it does change the web version of php.

I understand that this can be a bit confusing for people who are used to using wampserver, but for someone who is using it for the first time, we are not used to having a left click menu in the bottom right icons. I hope this saves some time for others who have a similar issue than mine.

1

The wampmanager->Tools->Change PHP CLI Version menu only changes the version of PHP that will be used by wampmanager.exe to run all the PHP scripts that provide all the functionality of WAMPServer.

It has no effect on the version of PHP that will will be run from the command line in Windows.

If when you open a command windows and run the PHP interpreter >php.exe you actually get to the PHP interpreter, then you must have added one of the possible paths to one of WAMPServers PHP folders to the Window's PATH. You should never do this with WAMPServer, so if this is what you did, UNDO IT! This is for obvious reasons as you could have multiple versions of PHP available and want to run any one of them at any time as the CLI Version to test some code against multiple versions of PHP.

Instead create yourself a little batch/cmd file that accepts a php version as a parameter like in this answer I posted a while ago

With that you can set the PATH temporarily for the life of a command window ONLY. You can also make it include a PATH to the PEAR and/or COMPOSER folders at the same time, if you use either of these.

To check All VC Runtimes

There is a tool for checking if you have all the possible required VC Runtimes installed. Go to this page, the backup repo for WAMPServer, and download the little utility called Checks VC++ packages installed you will find it down near the bottom of the page. Download and run it, then throw it away, as it changes over time as new VC Runtimes become required.

Community
  • 1
  • 1
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149