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.
type: cd c:\xampp\mysql\bin then press enter. type: in mysql -u root -p then press enter.
If the XAMPP icon is in your system tray, you can click it to open the Control Panel. If you don't have the icon in your system tray, you can open the Control Panel by choosing Start All Programs Apache Friends XAMPP XAMPP Control Panel.
Your MySQL binaries should be somewhere under your XAMPP folder. Look for a /bin folder, and you'll find the mysql.exe client around. Let's assume it is in c:\xampp\mysql\bin, then you should fireup a command prompt in this folder. If you want to use mysqldump.exe, you should also find it there.
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.
I tested it, and it works.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With