I want to be able to run php scripts from the command line in Vista. Can someone please give me the setx code I need to get it to work?
Thanks
I tried: setx php "C:\the\path\to\php.exe"
It didnt work.
Printable View
I want to be able to run php scripts from the command line in Vista. Can someone please give me the setx code I need to get it to work?
Thanks
I tried: setx php "C:\the\path\to\php.exe"
It didnt work.
well, the "setx" command sets an environment variable, it doesn't run anything. I don't know why you'd be trying to use it to run a script.
to run something with PHP, you just need to point the PHP executable to your script. this should run script.php:
you can read more about using PHP from the command line with arguments and options here on php.netCode:E:\root\php5\php.exe E:\root\www\script.php
Thats wack, cant I have the php command work like the java command?
Isn't that what a environment variable is for?
huh? you don't need an environment variable to run java either. I think you're getting things very mixed up.
environment variables are variables stored for the system. they aren't required for anything you're doing. variables provide shortcuts; they do not run programs.
if you wanted a shorthand way to run php files (without needing to provide the full path of PHP), you could append the environment variable "path" with the path to PHP's installed directory. this will let you run "php.exe" without needing to be in PHP's native directory.
then, you could run this:Code:set path=%path%;E:\root\php5
if you'd like to permanently add that path to the "path" variable, then you'll need to change the environment variables. in windows explorer, type in the path, "Control Panel\System and Maintenance\System", then click on "Change Settings." you'll need to confirm with UAC if you have it on. go to the "Advanced" tab, then to "Environment Variables" at the bottom. under "System Variables," there will be one named "Path." you can simply append ";E:\root\php5" to it, not forgetting to add the semi-colon. and don't get rid of any of the information inside of that variable already.Code:php E:\root\www\script.php
was exactly what I was looking for. Thanks guy.Code:set path=%path%;E:\root\php5
This works but when I reboot it no longer works. How do I make it stick?Code:set path=%path%;E:\root\php5
read the last paragraph of my last post in this thread.
woops, missed it. Got to excited about set path=%path%;E:\root\php5. It works, thanks.