Created
December 4, 2015 23:25
-
-
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]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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