<?php
$htmlcontent=$_POST['source'];
$pngname=$_POST['pngname'];
$height=$_POST['height'];
$width=$_POST['width'];
if(!isset($htmlcontent)){die('No HTML Cannot Proceed');}
$sourcefile='/var/www/CutyCapt/Sources/sourcefile.html';
$pngfile='/var/www/CutyCapt/Captures/'.$pngname;
$hyperlink='http://my.domain.com/CutyCapt/Captures/'.$pngname;
$htmlfile=fopen($sourcefile,'w') or die('Source Initialization Failed');
fwrite($htmlfile,$htmlcontent);
fclose($htmlfile);
if(!file_exists($sourcefile)){die('Parser Source Does not Exist! Operation aborted');}
//Generate SnapShot
shell_exec('/usr/bin/CutyCapt --html='.$sourcefile.' --out='.$pngfile.' --min-height='.$height.' --min-width='.$width);
//shell_exec('/usr/bin/CutyCapt --html=source.htm --out=test.png --min-height=600 --min-width=800');
if(!file_exists($pngfile)){die('Image Not Created');}
else
echo $hyperlink;
?>
This is my code. This can work fine, when i try from terminal, with php interpreter the script works fine. But when it comes to webserver, it wont execute at all. All libs and CutyCapt resides in /usr/bin/ only. Any suggestions?