exec() , shell_exec() , system() ???
| From: | prg | Date: | Tue, 18 Jun 2002 15:24:53 +0000 |
| Subject: | exec() , shell_exec() , system() ??? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-102710@lists.php.net to get a copy of this message | ||
Hola/Hi ,
I'm having a problem when I tried to get a result from
my script. I don't know how to fix it, I already read the on-line manual
in php.net but still I have the same problem.. :(
The "$result" (array) variable is empty. lenght = 0
I tried with: $result = shell_exec($cmdline);
but it's empty too...
however, when I put the cmdline in the prompt:
/web/cgi-bin/check.cgi /web/cgi-bin/temp/12345AA.txt
it's works fine..
I'm testing in a Solaris 2.6 with apache 1.3.24 and php 4.1.2
and the user that I test in the prompt was nobody
script
-----------------------------------------------
$filename = "/web/cgi-bin/temp/$ID_VAR.txt";
$fp=fopen($filename,"w");
reset($HTTP_POST_VARS);
while (list($key,$val) = each($HTTP_POST_VARS))
{
fwrite($fp,"$key=$val&");
}
fclose($fp);
unset($result);unset($retint);
$cmdline = "/web/cgi-bin/check.cgi $filename";
exec($cmdline,$result,$retint); // <-----this line!!!!!
if ($result[0]=="GOOD") { echo "OK";}
else { echo "KO";}
-----------------------------------------------
values when I print out variables:
$result = Array
sizeof($result) = 0
$result[0] =
$result[1] =
$retint = 248
I apology because my english isn't good enough..
if someone speak spanish I could give more details about my problem.
Thanks.
--
prg