Hi Havelly,
Just like any other executable in windows, windows need to know where to look for your php.exe program.
Because in WAMPServer you can actually switch between any number of PHP versions easily, it is a VERY BAD idea to add a specific version of PHP to the Windows PATH although you may see that suggested on many blogs (
There is lots of data out there, but very little good information).
I use the following mechanism :-
So that I can open a command windows any time I like and temporarily, add the version of PHP I currently want to run to the Windows PATH, I created this little batch file :-
Called phppath.cmd
echo off
if %1.==. GOTO THEDEFAULT
ECHO Setting up PHP%1
PATH=%PATH%;d:\wamp\bin\php\php%1
REM ONLY UNCOMMENT THESE LINES IF YOU HAVE INSTALLED PEAR ON YOUR SYSTEM
REM set PHP_PEAR_SYSCONF_DIR=D:\wamp\bin\php\php%1
REM set PHP_PEAR_INSTALL_DIR=D:\wamp\bin\php\php%1\pear
REM set PHP_PEAR_DOC_DIR=D:\wamp\bin\php\php%1\docs
REM set PHP_PEAR_BIN_DIR=D:\wamp\bin\php\php%1
REM set PHP_PEAR_DATA_DIR=D:\wamp\bin\php\php%1\data
REM set PHP_PEAR_PHP_BIN=D:\wamp\bin\php\php%1\php.exe
REM set PHP_PEAR_TEST_DIR=D:\wamp\bin\php\php%1\tests
echo ---------------------------------------------------------------
php -v
echo ---------------------------------------------------------------
GOTO END
:THEDEFAULT
echo Taking the default version php5.5.12
echo .
PATH=%PATH%;d:\wamp\bin\php\php5.5.12
REM set PHP_PEAR_SYSCONF_DIR=D:\wamp\bin\php\php5.5.12
REM set PHP_PEAR_INSTALL_DIR=D:\wamp\bin\php\php5.5.12\pear
REM set PHP_PEAR_DOC_DIR=D:\wamp\bin\php\php5.5.12\docs
REM set PHP_PEAR_BIN_DIR=D:\wamp\bin\php\php5.5.12
REM set PHP_PEAR_DATA_DIR=D:\wamp\bin\php\php5.5.12\data
REM set PHP_PEAR_PHP_BIN=D:\wamp\bin\php\php5.5.12\php.exe
REM set PHP_PEAR_TEST_DIR=D:\wamp\bin\php\php5.5.12\tests
echo ---------------------------------------------------------------
php -v
echo ---------------------------------------------------------------
:END
Now the idea is to put this .cmd file into a folder that is already on the Windows PATH so it can be run from anywhere.
So when you want to run a PHP CLI script, you open a command windows
CD into any folder containing your .php scripts
and then run this file like this,
To use the default PHP version you do
phppath
To use a specific php version you do
phppath 5.4.11
---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>Read The Manuals Apache --
MySQL --
PHP --
phpMyAdminGet your Apache/MySQL/mariaDB/PHP ADDONs here from the
WAMPServer alternate Repo-X-X-X-
Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-