I am running Xampp on my Windows 7 machine and was wondering if and how I could run commands for xampp via a command line. commands like php phpfile.php
Any advice would be appreciated.
asked May 25, 2012 at 10:44
XAMPP does not have a pre build console to run php
or mysql
commands, so, you have to add to windows PATH
environment variables, these 2: ;C:\xampp\mysql\bin;C:\xampp\php;
Then you should be able to execute php
and mysql
commands from the CMD.
UPDATE
I tested it, and it works.
answered May 25, 2012 at 10:51
AlexAlex
7,41022 gold badges82 silver badges150 bronze badges
1
You can set environment variables as mentioned in the other answers [like here]
or
you can open Start > CMD as administrator and write
C:\xampp\php phpfile.php
giovannipds
2,3122 gold badges28 silver badges36 bronze badges
answered May 27, 2012 at 13:06
1
Thank you guys for this answers. But I think the accepted answer needs more clarity, As i found difficulty in getting the solution.
We may set the environment variable as mentioned in the answer by w0rldart .
In this case[after seting envmnt var] we may run the phpFile by opening start >> CMD and typing commands like,
php.exe
or
php
example:
php.exe C:\xampp\htdocs\test.php
you can open Start >> CMD as administrator and write like