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

devdict's avatar

Wkhtmltopdf in shared hosting real server by composer.

Hello, I am using laravel snappy pdf tool to make pdf file by composer. I permited to access into "vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64" and other config snappy.php inside config folder.

But this error shows "The exit status code '127' says something went wrong: stderr: "/home/apcompan/domains/apcompany2007.com/public_html/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64: error while loading shared libraries: libXrender.so.1: cannot open shared object file: No such file or directory " stdout: "" command: /home/apcompan/domains/apcompany2007.com/public_html/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality '/tmp/knp_snappy5da8c5b5c74c72.02677327.html' '/tmp/knp_snappy5da8c5b5c77009.83999442.pdf'."

1 like
6 replies
Talinon's avatar

@dictator

You will need to install some X windows shared libraries that wkhtmltopdf uses to render.

Try this command: sudo apt-get install libfontconfig1 libxrender1

devdict's avatar

Thank you for the response. I develop a project on the localhost. Now its shared live project. How can i run this command "sudo apt-get install libfontconfig1 libxrender1". Sorry.

Sinnbeck's avatar

You need to talk to your server provider and ask them if you can install the libraries. As it is shared my guess would be that it is not allowed sadly.

Talinon's avatar

@dictator

You might be able to install the shared library somewhere within your home directory and then set your environment to look in that location for additional libraries.

If you're using Ubuntu, you can find the files here: https://packages.ubuntu.com/search?keywords=libxrender1

Then set your environment variable within your .bashrc for the linker to find them within the directory you saved them. For example, if you stored them in /home/apcompany/shared

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/apcompany/shared"

I think they may work.. If not, you'll need to ask your provider.

saniyasaher20's avatar

I also have the same issue, In my laravel project, I used snappy pdf and it worked, but on shared hosting it wont work because of these two binary libraries, shared hosting doesnt allow to install these.

-wkhtmltopdf -wkhtmltoimage

Sinnbeck's avatar

@saniyasaher20 As I said 5 years ago.. You need to convince the provider to install them. Or get your own server (like a cheap vps from digital ocean or hetzner)

Please or to participate in this conversation.