I am trying to write a php script which will run another program that I have in the same folder. This other program returns some output to the screen and I want to be able to use the output, maybe write to a file or show it on the screen. The problem that I am facing is that the code works fine if I am logged in and on the command prompt type php scriptname.php but If I run the same script from the web browser I don't see any output. I have checked the apache logs, no error. I have set all permission to full on files that are being used.
The following is the code.
<?php
$pathN = "/home/httpd/html/testuser";
//$comm = "./FeatureExtraction $pathN/uploaded/db_image_query.ppm > $pathN/shape/testfile";
$comm = "./FeatureExtraction $pathN/uploaded/db_image_query.ppm";
echo $comm."<BR>";
$result=exec($comm,$output);
echo $output;
$comma_separated = split(" ", $output);
if(strlen($output)>1)
{
echo "<BR>yes";
echo $comma_separated[1];
echo "$output\n";
foreach ($output as $p)
{
echo $p." ";
}
}
else
{
echo "<BR>no";
echo "<BR>result=$result";
}
echo "\n";
?>
I would appreciate any responses, because I have spent alot of time on this problem and I have a feeling that the problem could be very trivial.
Thanks.
please help. Problem external program through php
Moderator: General Moderators