How to Change the phpversions – WAMP?


Generally, the php version can be changed for the account in the environment variables.
It could be changed globally in the env variables, by simply selecting ‘Change env variables’.
The easiest way is to change in laragon settings, and then it’s the logged in user’s env variable is changed.
However when changing from php7+ to php 8+, an error occurs stating that the php8_module could not be found. I managed to sort it out as follows.

As I had laragon installed, all my php versions are in the laragon folder.
•get to the folder “C:\laragon\etc\apache2” and open file mod_php.conf
•This file is an autogenerated file. Therefore, the row numbers are essential to remain with the same code.
•If the changeover is for php 8, the line 2 should have the module as “LoadModule php_module” and not “LoadModule php8_module” For php 7, it should read “LoadModule php7_module”
•Once this change is done, then the apache server could be started easily.