PHPJasper / phpjasper

A PHP report generator
MIT License
464 stars 162 forks source link

Error when run jasper #205

Open malsmary opened 4 years ago

malsmary commented 4 years ago

( ! ) Fatal error: Uncaught PHPJasper\Exception\ErrorCommandExecutable: Your report has an error and couldn 't be processed!\ Try to output the command using the function output(); and run it manually in the console. in C:\wamp64\www\vendor\geekcom\phpjasper\src\PHPJasper.php on line 219

malsmary commented 4 years ago

such me ? how you solve it

mosharaf13 commented 4 years ago

I am facing this problem too. Any workaround?

dssen commented 4 years ago

Did you try the output() command as mentioned in the message?

You can try something easy as this and check the output of it:

$x = $jasper->process(
            $input,
            $output,
            $options
            )->output();
            print_r($x);
exit(1);//just to avoid getting error handler on your framework

Sometimes that will tell you more information. If it shows the command line to execute, try executing it directly on your command line, you might get more information there.

Common things to consider: - The user (probably the Web server user in your case) has no access or write access to the folder where you are creating the file - Perhaps the line was already generated before, and the error is that the file already exists. Try generating a random name for each report generation to avoid this; or generate the file, serve it in the application and delete it

erikafcf commented 4 years ago

I had the same problem. One thing I noticed is that in the example given, DIR is used but as I am using routes, the result of this function is returning ... /Http/Controllers ... where the hello_world.jrxml file does not exist. I copied the file to the Controllers folder to test but the error still occurs. To eliminate the permission problem, I was able to create a file in the same folder with the command $ file = fopen ( DIR. '/Meuarquivo.txt','w'). Does anyone have any idea what it might be? When executing the command return $ jasper-> process ($input, $output, $options) -> output (); the return is "./jasperstarter process "c:/workspace-phpjasper/scjf-api/app/Http/Controllers/hello_world.jasper" -o "c:/workspace-phpjasper/scjf-api/app/Http/Controllers" -f pdf rtf"

franklindotcom commented 3 years ago

I have the same problem with this library, someone has been able to find a solution (XAMP enviroment), regards!

AndresFS commented 1 year ago

Fix this issue by following these steps: 1) Move the sample file (hello_world.jrxml) to a folder where the framework can access (assets, public). 2) Go to the path "/vendor/geekcom/phpjasper/bin/jasperstarter/bin" and modify the permissions of the files "jasperstarter" and "jasperstarter.exe" to 755. 3) Use $jasper->compile($input)->execute();