barryvdh / laravel-snappy

Laravel Snappy PDF
MIT License
2.64k stars 292 forks source link

The process has been signaled with signal "11" #57

Closed samdiamond closed 4 years ago

samdiamond commented 9 years ago

OS: CentOS Linux 7.0.1406 Laravel 5.1

Hi,

I have installed wkhtmltopdf directly and it runs fine from the command line.

However, when using this package I get the following error (truncated to the first few lines):

RuntimeException in Process.php line 367:
The process has been signaled with signal "11".

1. in Process.php line 367
2. at Process->wait() in Process.php line 210
3. at Process->run() in AbstractGenerator.php line 475
4. at AbstractGenerator->executeCommand('/usr/local/bin/wkhtmltopdf --lowquality '/tmp/knp_snappy559fd7e4d812d7.68804302.html' '/tmp/knp_snappy559fd7e4d827b6.83747916.pdf'')  in AbstractGenerator.php line 147
5. at AbstractGenerator->generate(array('/tmp/knp_snappy559fd7e4d812d7.68804302.html'), '/tmp/knp_snappy559fd7e4d827b6.83747916.pdf', array(), false) in Pdf.php line 57
6. at Pdf->generate(array('/tmp/knp_snappy559fd7e4d812d7.68804302.html'), '/tmp/knp_snappy559fd7e4d827b6.83747916.pdf', array()) in AbstractGenerator.php line 177
7. at AbstractGenerator->getOutput(array('/tmp/knp_snappy559fd7e4d812d7.68804302.html'), array()) in AbstractGenerator.php line 198
...

These files are never written to the /tmp/ directory - it has drwxrwxrwt permissions, and I can write to this directory from the command line with wkhtmltopdf.

The controller function is set up very simply, and the correct variables are being passed according to the error logs:

public function pdf($vars)
    {
        $pdf = PDF::loadView('pdf', compact('vars'));
        return $pdf->download('example.pdf');
    }

The snappy.php config file is pointing correctly to usr/local/bin/wkhtmltopdf.

Any help or guidance would be greatly appreciated!

cesarve77 commented 9 years ago

+1

vijayhrdm commented 9 years ago

I am facing the same issue. in my case the error signal is 5

RuntimeException in Process.php line 367: `````` The process has been signaled with signal "5". in Process.php line 367 at Process->wait() in Process.php line 210 at Process->run() in AbstractGenerator.php line 475 at AbstractGenerator->executeCommand('/usr/local/bin/wkhtmltopdf --lowquality '/var/folders/23/8bf62plx29146fn0jzw1g03h0000gn/T/knp_snappy55b808388aa5d5.80082717.html' '/var/folders/23/8bf62plx29146fn0jzw1g03h0000gn/T/knp_snappy55b808388ac4e2.48115642.pdf'') in AbstractGenerator.php line 147 at AbstractGenerator->generate(array('/var/folders/23/8bf62plx29146fn0jzw1g03h0000gn/T/knp_snappy55b808388aa5d5.80082717.html'), '/var/folders/23/8bf62plx29146fn0jzw1g03h0000gn/T/knp_snappy55b808388ac4e2.48115642.pdf', array(), false) in Pdf.php line 57 at Pdf->generate(array('/var/folders/23/8bf62plx29146fn0jzw1g03h0000gn/T/knp_snappy55b808388aa5d5.80082717.html'), '/var/folders/23/8bf62plx29146fn0jzw1g03h0000gn/T/knp_snappy55b808388ac4e2.48115642.pdf', array()) in AbstractGenerator.php line 177 at AbstractGenerator->getOutput(array('/var/folders/23/8bf62plx29146fn0jzw1g03h0000gn/T/knp_snappy55b808388aa5d5.80082717.html'), array()) in AbstractGenerator.php line 198 at AbstractGenerator->getOutputFromHtml('

Emotional Intelligence and Competence Report

A . M . Jinturkar

09 - Oct - 2014

About this report

What Is Emotional Intelligence ?

Have you ever wondered why the smartest person in your class didn't become the most successful, or why someone who was 'just average' in academic exams went on to achieve great success in business, at work, in social life?

The missing link has now been identified as Emotional Intelligence, which is responsible for our success to a great extent. It is a much better predictor of success in various spheres of life unlike conventional ‘intelligence’ which predicts success only at academic exams and in some technical jobs.

Although the term "emotional intelligence" has come to mean many different things, it consists of two parts: emotion and intelligence. "Emotions" refer to the feelings a person has in a relationship. For example, if a person has a good relationship with someone else, that individual is happy; if the person is threatened, he or she is afraid. Intelligence, on the other hand, refers to the ability to process information and make decision with or about something. For example, one processes information and draws conclusions using language in the case of verbal intelligence, or does the same about how objects fit together in the case of spatial intelligence. In the case of emotional intelligence, one processes information related to emotions, or emotions assist one's thinking . That is, emotional intelligence, as measured by the EQiP, refers to the capacity to identify emotional signals, process emotions, manage emotions and use them effectively to manage relationships .

LRC(Lena Research and Consulting) Model of Emotional Intelligence:

', array()) in PdfWrapper.php line 149 at PdfWrapper->output() in PdfWrapper.php line 189 at PdfWrapper->download('report.pdf') in reportController.php line 143 at ReportController->generatePdfReport(object(TestEvent), '3', object(mPDF)) in reportController.php line 78 at ReportController->getReport('eeb1be44c3416888811902d663029377', '3', 'pdf') in reportController.php line 44 at ReportController->sayHello() at call_user_func_array(array(object(ReportController), 'sayHello'), array()) in Controller.php line 256 at Controller->callAction('sayHello', array()) in ControllerDispatcher.php line 164 at ControllerDispatcher->call(object(ReportController), object(Route), 'sayHello') in ControllerDispatcher.php line 112 at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103 at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114 at ControllerDispatcher->callWithinStack(object(ReportController), object(Route), object(Request), 'sayHello') in ControllerDispatcher.php line 69 at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\Report\reportController', 'sayHello') in Route.php line 201 at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134 at Route->run(object(Request)) in Router.php line 704 at Router->Illuminate\Routing\{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103 at Pipeline->then(object(Closure)) in Router.php line 706 at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 671 at Router->dispatchToRoute(object(Request)) in Router.php line 631 at Router->dispatch(object(Request)) in Kernel.php line 237 at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50 at VerifyCsrfToken->handle(object(Request), object(Closure)) at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 54 at ShareErrorsFromSession->handle(object(Request), object(Closure)) at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62 at StartSession->handle(object(Request), object(Closure)) at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37 at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59 at EncryptCookies->handle(object(Request), object(Closure)) at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103 at Pipeline->then(object(Closure)) in Kernel.php line 123 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 88 at Kernel->handle(object(Request)) in index.php line 54 ```
ChenAlon commented 9 years ago

You should set the binary path in snappy.php config file to the binary in the vendor directory:

<?php

return array(
    'pdf' => array(
        'enabled' => true,
        'binary' => base_path('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'),
        'timeout' => false,
        'options' => array(),
    ),
    'image' => array(
        'enabled' => true,
        'binary' => base_path('vendor/h4cc/wkhtmltoimage-amd64/bin/wkhtmltoimage-amd64'),
        'timeout' => false,
        'options' => array(),
    ),
);

It might work for you.

crgrove commented 9 years ago

+1

BenK-T commented 9 years ago

I got around this error by setting the 'disable-javascript' option to true. To be honest, I don't know how/why this fixed it for me, but I found that solution from here.

$pdf = PDF::loadHTML($html)
    ->setOption('disable-javascript', true)
    ->stream();
joaomlopes commented 8 years ago

I've got the config/snappy.php binary path correctly to my wkhtmltopdf-amd64 and I've tried with that disable-javascript option and none of them worked. Anyone has more clues or opinions on about to solve this?

vvinhas commented 8 years ago

+1

nicoavn commented 8 years ago

+1

bfblackjack commented 8 years ago

Also having this issue. None of the above has helped.

adnanmokhtar commented 8 years ago

i have the sane issue. any help?

Mr-Anonymous commented 7 years ago

I have the same issue. However, the error is not consistent. Sometimes I get this error and sometimes the pdf gets created properly without the error.

palypster commented 7 years ago

Same issue here, none of the above worked. Any idea where to start, how to debug?

pmaniora commented 7 years ago

Is wkhtmltopdf-amd64 working from command line? In my case file wkhtmltopdf-amd64 was corrupted. I downloaded it again and it started working.

francescozanoni commented 5 years ago

Hi. In case of HTML-2-PDF, our workaroud is to slightly change the font size:

wanlerong commented 4 years ago

stucking here

crying2812 commented 4 years ago

I got same issue..

tkaarlas commented 4 years ago

Same issue here. However, just noticed that if I run ./wkhtmltopdf via ssh (with or without parameters), I get Segmentation fault error, so this probably has anything to do with Snappy in the end. Sadly I'm forced to use shared hosting on this project, so that might affect things a bit. I've tried almost all versions of wkhtmltopdf already, and got confirmation from the hosting company that it should be ok to run wkhtmltopdf binary.

tkaarlas commented 4 years ago

Same issue here. However, just noticed that if I run ./wkhtmltopdf via ssh (with or without parameters), I get Segmentation fault error, so this probably has anything to do with Snappy in the end. Sadly I'm forced to use shared hosting on this project, so that might affect things a bit. I've tried almost all versions of wkhtmltopdf already, and got confirmation from the hosting company that it should be ok to run wkhtmltopdf binary.

I finally got rid of Segmentation fault error by asking my hosting which version should 100% work on their CloudLinux - 0.10.0_rc2-static-amd64 they answered, and via SSH it actually fully works! However, still having this signal error, raised in symfony/process/Process.php. First it was signal '11' but after giving 0777 permissions for wkhtmltopdf, it changed to signal '4' error.

EDIT: In my case, these errors are caused by header-html, however the content of header html does not matter. And for some reason every second error is signal 11 and every second is signal 4. Any ideas what might cause this? If I just ->setOption('header-html', 'testing'), it works. But if I use url('template_header') instead (doesn't matter what that file contains), it breaks down. In my dev environment (XAMPP with more recent version of wkhtmltopdf) everything works, but in shared hosting with 0.10.0_rc2 wkhtmltopdf this happens.

EDIT2 - solved: Using view()->make('templates.header_template')->render() instead of url('template_header') (eventhough my routing, naming, etc is correct) seems to work when getting the header html! My css ain't working at all though, but it's most likely not related to this problem.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/KnpLabs/snappy instead. When having doubts, please try to reproduce the issue with just snappy. If you believe this is an actual issue with the latest version of laravel-snappy, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

garbinmarcelo commented 3 years ago

Same issue here. However, just noticed that if I run ./wkhtmltopdf via ssh (with or without parameters), I get Segmentation fault error, so this probably has anything to do with Snappy in the end. Sadly I'm forced to use shared hosting on this project, so that might affect things a bit. I've tried almost all versions of wkhtmltopdf already, and got confirmation from the hosting company that it should be ok to run wkhtmltopdf binary.

I finally got rid of Segmentation fault error by asking my hosting which version should 100% work on their CloudLinux - 0.10.0_rc2-static-amd64 they answered, and via SSH it actually fully works! However, still having this signal error, raised in symfony/process/Process.php. First it was signal '11' but after giving 0777 permissions for wkhtmltopdf, it changed to signal '4' error.

EDIT: In my case, these errors are caused by header-html, however the content of header html does not matter. And for some reason every second error is signal 11 and every second is signal 4. Any ideas what might cause this? If I just ->setOption('header-html', 'testing'), it works. But if I use url('template_header') instead (doesn't matter what that file contains), it breaks down. In my dev environment (XAMPP with more recent version of wkhtmltopdf) everything works, but in shared hosting with 0.10.0_rc2 wkhtmltopdf this happens.

EDIT2 - solved: Using view()->make('templates.header_template')->render() instead of url('template_header') (eventhough my routing, naming, etc is correct) seems to work when getting the header html! My css ain't working at all though, but it's most likely not related to this problem.

Sorry to answer this post so late, but I'm experiencing the same problem using CloudLinux. Did you manage to solve? How is your snappy.php configuration?

dauvray commented 2 years ago

Replace assset() with public_path() in views solved the problem to me

RoduanKD commented 2 years ago

for me, the solution was to download and install wkhtmltopdf from here instead of using the composer dependency.

I'm using Centos 8

waqleh commented 2 years ago

I had this issue while running laravel v9, laravel-snappy v1, phpunit v9 with Alpine Linux in gitlab CI. I was able to fix it by install some dependencies by changing the following in gitlab-ci.yml, from: - apk add --no-cache wkhtmltopdf to: - apk add --no-cache wkhtmltopdf xvfb ttf-dejavu ttf-droid ttf-freefont ttf-liberation

I derived this solution from https://sasablagojevic.com/setting-up-wkhtmltopdf-on-docker-alpine-linux

riaanjfox commented 2 years ago

I had this issue while running laravel v9, laravel-snappy v1, phpunit v9 with Alpine Linux in gitlab CI. I was able to fix it by install some dependencies by changing the following in gitlab-ci.yml, from: - apk add --no-cache wkhtmltopdf to: - apk add --no-cache wkhtmltopdf xvfb ttf-dejavu ttf-droid ttf-freefont ttf-liberation

I derived this solution from https://sasablagojevic.com/setting-up-wkhtmltopdf-on-docker-alpine-linux

This worked - kept me struggling for hours. Thank you!

joedave13 commented 1 year ago

Replace assset() with public_path() in views solved the problem to me

Thank you, my problem is solved with this solution

RVP04 commented 1 year ago

public_path

I dont have asset()

hagansamuel6 commented 4 months ago

Here is how i solved this error on Almalinux 8, I downloaded the x86_64 version from https://wkhtmltopdf.org/downloads.html and uploaded it to the server and installed with the command sudo dnf install -y <full_name_of_uploaded_file>, after installation run which wkhtmltopdf to get the installation path, it is usually /usr/local/bin/wkhtmltopdf, from here on you can add this path as environment variable and reference it within the snappy.php config file as the binary path. Hopefully this helps someone, thank you