Skip to content

Instantly share code, notes, and snippets.

@hieblmedia
Created December 4, 2015 23:25
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hieblmedia/d83b0ace4861a51344ca to your computer and use it in GitHub Desktop.
Save hieblmedia/d83b0ace4861a51344ca to your computer and use it in GitHub Desktop.
Dynamic PHP executabe for wampserver depend on current enabled version. [tested on Windows10 with Wampserver3_x86]
@REM This file detects the current enabled PHP version of wampserver (http://www.wampserver.com/) and executes the enabled php.exe and all parameters are passed
@REM Copy this file to WAMPSERVERPATH\bin\php
@REM Now you can add WAMPSERVERPATH\bin\php to your Windows Environment-Variable "PATH". Now you can use "php" global. For example "php -v".
@REM You can show the current PHP version with "php -v"
@setlocal enableextensions enabledelayedexpansion
@echo off
set serverPath="%~dp0\..\.."
set file="!serverPath!\wampmanager.conf"
set area=[php]
set key=phpVersion
FOR /F "tokens=*" %%a IN ('type %file%') DO (
set ln=%%a
if "x!ln:~0,1!"=="x[" (
set currarea=!ln!
) else (
for /f "tokens=1,2 delims== " %%b in ("!ln!") do (
set currkey=%%b
set currval=%%c
if "x!area!"=="x!currarea!" (
if "x!key!"=="x!currkey!" (
set !currkey!=!currval:"=!
)
)
)
)
)
CALL !serverPath:"=!\bin\php\php!%key%!\php.exe %*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment