We are getting an error "Could not execute phantomjs". All permissions(executable for all users) are set properly. It is not working on our local system too.
1) Procedure 1
Source Code:
require_once "SakilaRental.php";
$report = new SakilaRental;
$report->run()->export('SakilaRentalPdf')->pdf(array("format"=>"A4","orientation"=>"portrait"))->toBrowser("sakila_rental.pdf");
Error
phantomjs path: /opt/lampp/htdocs/koolreport/packages/export/bin/phantomjs
Fatal error: Uncaught exception 'Exception' with message 'Could not execute phantomjs' in /opt/lampp/htdocs/koolreport/packages/export/Handler.php:72 Stack trace: #0 /opt/lampp/htdocs/koolreport/packages/export/Handler.php(237): koolreport\export\Handler->runPhantom('/opt/lampp/htdo...', '/tmp/5c91cdc31d...', '/tmp/5c91cdc31d...', 'eyJmb3JtYXQiOiJ...') #1 /opt/lampp/htdocs/koolreport_examples/reports/export/sakila_rental/export.php(13): koolreport\export\Handler->pdf(Array) #2 {main} thrown in /opt/lampp/htdocs/koolreport/packages/export/Handler.php on line 72
2) Procedure 2
Then I installed the phantomjs in the local system and using the path of phantomjs same error occurs.
phantomjs installed path: /usr/bin/phantomjs
Source Code:
$report->run()->export('SakilaRentalPdf') ->settings(array("phantomjs"=>"/usr/bin/phantomjs"))->pdf(array( "format"=>"A4","orientation"=>"portrait")) ->toBrowser("sakila_rental.pdf");
Error:
Fatal error: Uncaught exception 'Exception' with message 'Could not execute phantomjs' in /opt/lampp/htdocs/koolreport/packages/export/Handler.php:72 Stack trace: #0 /opt/lampp/htdocs/koolreport/packages/export/Handler.php(237): koolreport\export\Handler->runPhantom('/opt/lampp/htdo...', '/tmp/5c91d3bbbc...', '/tmp/5c91d3bbbc...', 'eyJmb3JtYXQiOiJ...') #1 /opt/lampp/htdocs/koolreport_examples/reports/export/sakila_rental/export.php(12): koolreport\export\Handler->pdf(Array) #2 {main} thrown in /opt/lampp/htdocs/koolreport/packages/export/Handler.php on line 72
Please help us to solve the issue.