Author Topic: Tutorial: PHP-VersionsSwitcher for Xampp  (Read 1792 times)

Offline jacobi22

  • Global Moderator
  • *****
  • Posts: 4454
  • Gender: Male
    • Jacobi22
Tutorial: PHP-VersionsSwitcher for Xampp
« on: January 08, 2017, 03:14:05 PM »
if you work with the locale XAMPP-Server, maybe its good, if you can switch between different PHP-Versions. The Limiter for this Switch is your Xampp-Version. So its not possible to switch to a Version PHP 5.6.x, if your package needs a Version PHP 7.x. For this case, i use different Xampp-Installations and rename the xampp-folders, before i start the server

to the switch:
- a running Xampp-Installation on your locale PC, recommened the latest version from here ->
- a different PHP-Version, maybe from here -> - i use for a example VC14 x86 Thread Safe for Windows
- the PHP-Switcher  from the attachement or from here ->

- Unpack this Switcher-Package into your locale Xampp-Folder, it will overwrite the existing Readme-Files, choose yes or no
- you need from the package in this zip the folder called "lib", a config.ini, the file php_switchbat and php_switch.php in the Xampp-Main-Folder
- open the config.ini with a simple editor and change there the yellow marked settings, the path to Xampp, the path to the php inside of xampp and the apacheService (older Xampp-Versions has Apache 2.2)

- rename the not used php-Folder and add there the php-Version, for example a folder with PHP 7.0.14 has the Name php_7.0.14
- dont rename the folder with name php - Xampp works only with the folder php (if you dont change the original settings), the switcher rename the folders

View in Windows-Explorer / Xampp-Folder

- you need inside of every php-versions-folder a file called PHP_VERSION. Content of this file is the versions number, like 7.0.14, not more
- you need a php.ini in every php-folder - in most cases, its enough, when you rename one of the php-ini-files in the php-folder, like php.ini-development to php.ini. if its not work, try a php.ini from a working-php-version

to use the Versions-Switch, be sure, that you stop a actual running apache server in your xampp-control-panel
to start the switch, start the file php-switch.bat ( i send this file to my desktop and change the icon (use the icon from xampp for that)

a DOS-Window starts, the Script reads the different php-folders and build a list. Select the PHP-Version, tip the number and close the window.
now you can start the apache server - if no red error come, everything is good and you can work with the different version

Last step: check the used PHP-Version in WB-Backend - Systeminfo (info-Button in the top-menu)

« Last Edit: January 08, 2017, 03:19:32 PM by jacobi22 »
Du bist der Mensch, der mich zum Lachen bringt und der, der mit mir weint. Ich muss lachen, wenn du lachst und weinen, wenn du weinst und darum wirst du für immer ein Teil von meinem Herzen sein
(*miss you*)