I have compiled a matlab script into a standalone win app and also a console app. The script can be called from the command line using image_process pic1.png. The exe runs and produces a string as a result. No I want to deploy it in php. I have added a folder to my main website directory called uploads. I need to run php to call the matlab exe to run on the images inside this folder.
Now I go to my PHP script. I define my uploads directory :
define("UPLOAD_DIRECTORY","./uploads"); // defines the uploads directory
then I add the path to my image processor: define("IMAGE_PROCESSORE",dirname(dirname(FILE))."/image_process.exe");
at last I configure my process like :
case "process":
$res=array();
$pic=isset($_REQUEST["pic"])?trim($_REQUEST["pic"]):"";
if($pic==""){
echo "No picture name is passed";
exit();
}
exec(IMAGE_PROCESSORE.' "'.realpath(UPLOAD_DIRECTORY).'" '.$pic,$res);
//exec(IMAGE_PROCESSORE." ".$pic,$res); // this one if I define the image_process.exe inside the uploads folder
echo"<pre>";
print_r($res);
echo"</pre>";
break;
So when I call my php like :
localhost/mysitename/phpresponse.php?act=process&pic=pic1.png
I will get no output, but If I run
localhost/mysitename/phpresponse.php?act=process&pic=c:\xampp\htdocs\mysitename\uploads\pic1.png
The matlab compiled file will run and execute
I am really confused, I did try many things but with no luck...