Passthru not working
Posted: Mon Jun 10, 2002 11:35 pm
I am trying to use the passthru command to run an executable.
<?php
@ $p1= $HTTP_POST_VARS["param1"];
@ $p2= $_POST["param2"];
trim($computer);
trim($sid);
if (!$p1|| !$p2)
{
echo "You have not entered the correct arguments. Please go back and try again.";
exit;
}
$command = "c:\program files\webserver\cgi-bin\myexec.exe \\\\".$computer." ".$sid;
echo $command;
passthru($command);
?>
</body>
</html>
I don't think that I have coded it wrong because I get no errors and I echo $command returns the proper value. If I substitute my command for something like "time /t" it works just fine.
I thought that safe mode might have something to do with it so I tried it with safe mode both on and off. It didn't make any difference. I have also set the safe_mode_exec_dir directive to the same path I have used in the code.
I read somewhere that it might be a permissions problem but right now the permissions to the directory and executable are set to full control for everyone.
Could someone help me pass this obstacle? I would greatly appreciate it.
By the way, I'm not to keen on turning safe mode off.
Paul
<?php
@ $p1= $HTTP_POST_VARS["param1"];
@ $p2= $_POST["param2"];
trim($computer);
trim($sid);
if (!$p1|| !$p2)
{
echo "You have not entered the correct arguments. Please go back and try again.";
exit;
}
$command = "c:\program files\webserver\cgi-bin\myexec.exe \\\\".$computer." ".$sid;
echo $command;
passthru($command);
?>
</body>
</html>
I don't think that I have coded it wrong because I get no errors and I echo $command returns the proper value. If I substitute my command for something like "time /t" it works just fine.
I thought that safe mode might have something to do with it so I tried it with safe mode both on and off. It didn't make any difference. I have also set the safe_mode_exec_dir directive to the same path I have used in the code.
I read somewhere that it might be a permissions problem but right now the permissions to the directory and executable are set to full control for everyone.
Could someone help me pass this obstacle? I would greatly appreciate it.
By the way, I'm not to keen on turning safe mode off.
Paul