Scamquist
asked on
Call BAT file from PHP on IIS 6.0 server
I am trying to call a bat file from php. I am testing this so the contents of the bat file is:
Msg * "If this opened, the call worked"
All it is intended to do is open a message box with some text.
This attached code just shows DONE! on the screen when I clock the Do It button. The message box does not open.
The full path to the bat file is:
C:\Inetpub\wwwroot\PHP_Cal l.bat
The full path to the php file is:
C:\Inetpub\wwwroot\CallFil e.php
Any ideas?
Msg * "If this opened, the call worked"
All it is intended to do is open a message box with some text.
This attached code just shows DONE! on the screen when I clock the Do It button. The message box does not open.
The full path to the bat file is:
C:\Inetpub\wwwroot\PHP_Cal
The full path to the php file is:
C:\Inetpub\wwwroot\CallFil
Any ideas?
<?php
if(isset($_POST['submit']))
{
exec("PHP_Call.bat");
echo "Done!";
} else {
// display the form
?>
<form action="" method="post">
<input type="submit" name="submit" value="DO IT!">
</form>
<?php
}
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Click on "Script source access" then. I was expecting something else. I tried it and I got this:
Warning: exec() [function.exec]: Unable to fork [PHP_Call.bat] in C:\Inetpub\wwwroot\EXECBAT .PHP on line 13
Warning: exec() [function.exec]: Unable to fork [PHP_Call.bat] in C:\Inetpub\wwwroot\EXECBAT
ASKER
Checked "Script source access"
Opened the page. Clicked Do IT!
no error. Just displayed DONE!
Opened the page. Clicked Do IT!
no error. Just displayed DONE!
Then it's probably working. The message would displayed on the command line since it's a command line batch file. But you're not on the command line, you're in your browser so you woudln't see it.
ASKER
Thank you.
ASKER
Am I looking in the wrong place?