New to phantomjs decided to use this to print screenshots from webpages. From the terminal everything works fine but when executing from PHP script with shell_exec function the render doesn’t work.
this is just the part that is executing phantom from PHP. Other commands executed with shell_exec work, just not the render.
$output = shell_exec("phantomjs phantom.js");
echo $output;
this is the phantom script that works fine when executed on the shell
var page = require('webpage').create();
page.open( "http://www.google.co.uk" , function(s){
var title = page.evaluate(function(){
var main = document.getElementsByTagName("center");
main[0].style.visibility = "hidden";
return document.title;
});
console.log("rendering now");
page.render("title" + ".png");
phantom.exit();
});
shell_execcall.php.ini's. You might have blockedshell_exec/ paths / safe_modes in/etc/php5/apache2/php.ini, but not in/etc/php5/cli/php.ini