KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Could not execute phantomjs #760

Open Thangavel opened this topic on on Mar 25, 2019 - 12 comments

Thangavel commented on Mar 25, 2019

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.

KoolReport commented on Mar 25, 2019

Please don't set this:

->settings(array("phantomjs"=>"/usr/bin/phantomjs"))

does it works. It seems to me you are running phantomjs in a diferent folder (not sure it is existed)

Thangavel commented on Mar 25, 2019

I have followed two procedure as per examples in the export package, faced the same error (Could not execute phantomjs) in both procedures. Please check the previous post.

KoolReport commented on Mar 26, 2019

May I know your OS and PHP version? is the shell_exec() allowed in your PHP?

From what I have seen above, you did install the phantomjs by command line in "/usr/bin/phantomjs" folder? don't you?

If you just enter "/usr/bin/phantomjs" to the command line? does it work?

Thangavel commented on Mar 26, 2019

OS: Ubuntu 18.04

PHP Version: 5.6.36

yes, shell_exec() is allowed and able to run through examples.

yes, I have installed the phantomjs locally through command line as per setting instruction and set path of phantomjs in procedure 2. also I can able to run the phantomjs through command and its working.

"In some case, your server required phantomjs to be installed rather than used directly from bin folder. After installing phantomjs, you may use the "phantomjs"=>"/path/to/phantomjs" to let Export package know how to call PhantomJS executed file."

KoolReport commented on Mar 27, 2019

So you mean our export example work but not your report.

Thangavel commented on Mar 27, 2019

No, I have tried as per export example with both ways 1. Phantomjs file in export bin folder. 2. Phantomjs installed in the local system and use path in settings.

Both the procedure are not working. Please refer to my first post.

Shirish Bendre commented on Jan 8, 2021

Hello, I have taken pro package of KoolReport Pro. I am getting error of PHP Fatal error: Uncaught Exception: Could not execute phantomjs. Can you please help me with the error.

Sebastian Morales commented on Jan 11, 2021

Shirish, pls download the PhantomJS binary file to folder koolreport/export/bin and set its permission to executable:

https://phantomjs.org/download.html

Subbu Annamalai commented on Sep 8, 2022

Hello, I am getting error in simple MyPage example 'Fatal error: Uncaught Exception: Could not execute phantomjs in...' I have placed phantomjs in export/bin folder and also given permission. shell_exec is also enabled. Php error log shows like 'public_html/koolreport/export/bin/phantomjs() [0x1a8ea33]'. $result from shell_exec returns ''.

Please guide me. Regards

Sebastian Morales commented on Sep 14, 2022

Pls open the file koolreport/export/Handler.php and add the following line:

        echo "command = $command<br>"; exit; // add this line
        $result = shell_exec($command);

Then run export to see the output phantomjs command. Copy and paste it into your terminal/command line to see if there's any error message. Tks,

Kaizen initiative commented on Oct 25

Fatal error: Uncaught Exception: Could not execute phantomjs in /home/usr/public_html/koolreport/koolreport/export/Handler.php:97 Stack trace: #0 /home/usr/public_html/koolreport/koolreport/export/Handler.php(262): koolreport\export\Handler->runPhantom('/home/uer...', '/tmp/671bb2a243...', '/tmp/671bb2a243...', 'eyJmb3JtYXQiOiJ...') #1 /home/usr/public_html/koolreport/export.php(62): koolreport\export\Handler->pdf(Array) #2

when i try to execute: /home/usr/public_html/koolreport/koolreport/export/bin/phantomjs --ignore-ssl-errors=true /home/usr/public_html/koolreport/koolreport/export/pdf/pdf.js /tmp/671bb1230aff91.tmp /tmp/671bb1230b1172.pdf eyJmb3JtYXQiOiJBNCIsInpvb20iOjAsImV4cGVjdGVkTG9jYXRpb24iOiJodHRwczpcL1wvc3lzY29iZS5raWVzb2Z0LmNsb3VkXC9rb29scmVwb3J0XC9leHBvcnQucGhwIiwicmVzb3VyY2VXYWl0aW5nIjoxMDAwfQ==

i have this error: __Auto configuration failed 23449517209408:error:0E079065:configuration file routines:DEF_LOAD_BIO:missing equal sign:conf_def.c:362:line 75__

OS: AlmaLinux v9.4.0

PHP Version: 8.1

shell_exec() is allowed

Pls help...

Sebastian Morales commented on Oct 28

Pls install Phantomjs for your OS and verify that it works with standard tests:

https://phantomjs.org/quick-start.html

https://phantomjs.org/screen-capture.html

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Export