I'm trying to execute PhantomJS via PHP on my local host (MAMP) on MacOS.
I've installed PhantomJS
$ sudo cp phantomjs-1.9.8-macosx/bin/phantomjs /usr/local/bin
and made the file executable
$ sudo chmod +x /usr/local/bin/phantomjs
When I go to the folder containing my file hello.js and on the command line type
$ phantomjs hello.js
it works fine.
However, when I try it in PHP on index.php,
<?php
$response = exec('/usr/local/bin/phantomjs hello.js');
echo $response;
?>
I get nothing! What am I doing wrong? Any help is greatly appreciated.