Domanda

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.

È stato utile?

Soluzione 2

  1. Go to your desktop.
  2. Right click My Computer shortcut in the desktop.
  3. Click Properties.
  4. You should see a section of control Panel - Control Panel\System and Security\System.
  5. Click Advanced System Settings on the Left menu.
  6. Click Enviornment Variables towards the bottom of the window.
  7. Select PATH in the user variables list.
  8. Append your PHP Path (C:\myfolder\php) to your PATH variable, separated from the already existing string by a semi colon.
  9. Click OK
  10. Open your "cmd"
  11. Type PATH, press enter
  12. Make sure that you see your PHP folder among the list.

That should work.

Altri suggerimenti

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"
  1. install a php engine on windows

  2. in a cmd windows for example, run php <path/to/your/script>

  3. open cmd, go to where you installed php. and run c:\program files\php\php.exe <path/to/your/scirpt>.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/(dead link)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top