问题
I am trying to execute a php file from sos-berlin jobscheduler. My OS is windows 7. I am following the documentation
http://www.sos-berlin.com/mediawiki/index.php/How_to_execute_a_PHP_script_with_JS
#!/usr/bin/php
<?php
echo "hello";
?>
But when I executed the script I am getting the error that
'#!' is not recognized as an internal or external command, operable program or batch file.
I came to understand that #!/usr/bin/php is a linux command. I should give here equivalent batch command. I googled, but didn't find any useful result. Please any one help me...
Thanks in advance.
回答1:
- Go to your desktop.
- Right click My Computer shortcut in the desktop.
- Click Properties.
- You should see a section of control Panel - Control Panel\System and Security\System.
- Click Advanced System Settings on the Left menu.
- Click Enviornment Variables towards the bottom of the window.
- Select PATH in the user variables list.
- Append your PHP Path (C:\myfolder\php) to your PATH variable, separated from the already existing string by a semi colon.
- Click OK
- Open your "cmd"
- Type PATH, press enter
- Make sure that you see your PHP folder among the list.
That should work.
回答2:
Suppose you have installed php.exe in C:\Program files\MyPhpProgram\php.exe
Then run below 2 lines on terminal (cmd.exe):
assoc .php=phpfile
ftype phpfile="C:\Program files\MyPhpProgram\php.exe" "%1"
回答3:
1) install a php engine on windows
2) in a cmd windows for example, run php
3) open cmd, go to where you installed php. and run c:\program files\php\php.exe .php
link to setting up the path to include php so you can run it easily from cmd:
http://willj.co/2012/10/run-wamp-php-windows-7-command-line/
来源:https://stackoverflow.com/questions/16646003/windows-equivalent-to-usr-bin-php