I have been working on this particular issue for a number of days now. I am about to change my approach to write to batch files and execute my commands and returns throgh them, BUT... I will check with you all before I change directions.
I would like to execute a ping using the command as follows for example:
Some of the actual code is as follows:
<?php
require_once("sys_funcs.php");
error_reporting(0);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">
</head>
<body onLoad="parent.myNum=<?php echo ($GET['num'] + 1); ?>; parent.pingDone=true; parent.pingResult=<?php echo ping($GET['comp']); ?>;">
<?php
echo "ping ". $GET['comp'] .": ". ping($GET['comp']);
?>
</body>
</html>
function ping($comp) {
error_reporting(E_ALL);
flush();
$result = substr_count(shell_exec("ping -n 1 ".$comp), ": bytes");
testWrite("Ping Result for". $comp ."are". $result. "\r\n");
if ($result > 0) { return 1; }
return 0;
}
I have gone through a sequence of errors in attempting to solve this issue.
-Safe Mode is turned off (this is not the issue)
-I made security to CMD.EXE and the INETPUB files available to "Everyone" (for testing purposes) and recieved an "Access Denied" return
-Removed permissions to IUSR and got an invalid flag after regular expression.
-I have also had CGI header errors which are now resolved.
I have traced through the code and have determined that shell_exec command is my failure point.
Any suggestions?
FYI: running Windows server 2003, PHP 4.4.3, IISv6.0