Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AbdulBazith's avatar

how to use barryvdh/laravel-snappy package in live server cpanel

guys iam working with a project. it was running in live. everything works fine.

now i need charts and graphs as report, so i installed barryvdh/laravel-snappy package in my local.

what i did is for Wkhtmltopdf Installation

i visited this link: https://wkhtmltopdf.org/downloads.html -- 64 bit because my system 64 bit and installed it normally. it is installed in my c/program files.

next i gave composer require barryvdh/laravel-snappy

next i added it in config/app.php

Barryvdh\Snappy\ServiceProvider::class,

'PDF' => Barryvdh\Snappy\Facades\SnappyPdf::class,
'SnappyImage' => Barryvdh\Snappy\Facades\SnappyImage::class,

next i gave this php artisan vendor:publish --provider="Barryvdh\Snappy\ServiceProvider"

Next what i did is in config/snappy.php i changed like below

  'pdf' => [
        'enabled' => true,
        'binary'  => '"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe"',
        'timeout' => false,
        'options' => [],
        'env'     => [],
    ],

as it was installed in my local c/ program files

now i used the package and it worked fine in local.

now how i can take this package to cpanel server?

what i did is

copied the vendor folder, config folder, bootstrap folder, composer file, these to server.

is this enough?? how can i change the binary path in config/snappy.php in server?? what lines i should give there??

or else nothing to give, everything is fine??

kindly some one help please

0 likes
7 replies
AbdulBazith's avatar

In live iam getting this error

The exit status code '127' says something went wrong: stderr: "sh: C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe: command not found " stdout: "" command: "C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" --lowquality '/tmp/knp_snappy5eda86d6b1db60.16736040.html' '/tmp/knp_snappy5eda86d6b1ec54.99483053.pdf'.

bobbybouwmann's avatar

@abdulbazith You're using the windows path here. Your shared server is probably running on Ubuntu so you need to use a different path here.

Also, wkhtmltopdf needs to be installed on the server. Normally you can't do this with shared hosting. You need to find a different solution for your PDFs.

A good alternative is DOMPDF: https://github.com/barryvdh/laravel-dompdf

AbdulBazith's avatar

@bobbybouwmann thank you soo much for your response.

actually these much days i used barryvdh/laravel-dompdf only because just my client expected only tables so.

But now my client is a school. so they need charts, graphs, progress bar for student reports.

barryvdh/laravel-dompdf not supporting external css, javascript charts etc. so when i referred in google most of them said it is impossible to use barryvdh/laravel-dompdf for javascript charts,

so i planned to use barryvdh/laravel-snappy package.

in local pdf working fine. but as you said in live how i should do the change?? whether it is possible in shared hosting??

and one more thing i face error when working taking print out in images in barryvdh/laravel-snappy

the error is


The exit status code '1' says something went wrong: stderr: "Loading pages (1/6) [> ] 0% [======> ] 10% QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files [===========================> ] 45% Warning: Failed to load file:///C:/Users/Azasoft/AppData/Local/Temp/css/font-for-print.css (ignore) Warning: Failed to load file:///C:/Users/Azasoft/AppData/Local/Temp/css/question.css (ignore) Warning: Failed to load file:///C:/Users/Azasoft/AppData/Local/Temp/css/progress-bar.css (ignore) [============================> ] 48% Error: Failed to load c:/xampp/htdocs/Laravel/OnlineExam-18-05-2020-staff/public/storage/, with network status code 202 and http status code 0 - Cannot open c:/xampp/htdocs/Laravel/OnlineExam-18-05-2020-staff/public/storage/: Path is a directory 

what may be the problem???

AbdulBazith's avatar

@bobbybouwmann kindly please suggest any package. that need to support external css and js files.

still now i cant get any idea please..

you suggested Browsrshot but i need to fetch few data from db. i will list all the names in the screen and then i will check few students and then will take pdf. i think this is not possible in BrowserShot.

Kindly please suggest any package

Pratibha Rana's avatar

Hi, I also faced the same issue and now pdf in shared hosting "Hostinger" successfully working.

S1d's avatar

Hi @Pratibha Rana, how did you resolve it? Did you use LaravelSnappyPDF? I'm facing the same issues in my hostinger.

Please or to participate in this conversation.