3

I am using a Snappy PDF library in Laravel 5.7. Locally it works everything fine, but in my dev environment I get this error: The process has been signaled with signal "11". Till now I was not able to find a solution that would help me. This is my code in controller:

   public function pdfReport(Request $request){
    $pdf = \Snappy::loadView('index', compact(
                  'name', 'lname', 'date', 'address'
                  ))
                  ->setOrientation('portrait')
                  ->setOption('margin-bottom', 0)
                  ->setOption('margin-top', 0)
                  ->setOption('margin-left', 0)
                  ->setOption('margin-right', 0);
     return $pdf->download(str_replace(' ', '', $request->description) . Carbon::now()->format('dYm_His') . '.pdf');
  }

Any help is appreciated!!!

Felicity
  • 63
  • 1
  • 1
  • 8

3 Answers3

10

This is probably not related to the OP's question, but in case anyone else is getting this, it might be helpful:

In my case, the The process has been signaled with signal "11" exception was linked to an infinite loop. I encountered this exception when running a test case that was stuck in a self-calling recursion.

More generally speaking, a signal 11 is a segmentation fault, and the exception is raised by the Symfony Process class. A segmentation fault is usually an illegal memory access and can be caused by a buffer or stack overflow.

So, in my case, it was a stack overflow due to the infinite recursion.

Lupinity Labs
  • 2,099
  • 1
  • 15
  • 23
1

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

Waqleh
  • 9,741
  • 8
  • 65
  • 103
0

I solved it through composer. In my case its seemed to be coming from Symfony\process\process.php:441,

    do {
        $this->checkTimeout();
        $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
        $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
    } while ($running);

    while ($this->isRunning()) {
        $this->checkTimeout();
        usleep(1000);
    }

I followed every step but nothing worked. But after running "composer require h4cc/wkhtmltopdf-amd64" and "composer require barryvdh/laravel-snappy" I replaced the vendor directory on the server.