If you run Wkhtmltopdf from the console as root, then everything works fine.

If you switch to the user from which the site is running and PHP, then when you start the Wkhtmltopdf, it issues a Segmentation fault .

At the same time, if you set su and the root password, then when Wkhtmltopdf starts , everything works fine.

As I understand it, the user does not have enough rights for Wkhtmltopdf to function normally.

How to expand user rights?

  • one
    find out the cause of the error. then it becomes clear how to eliminate it. - aleksandr barakin

1 answer 1

the right way: find out (and eliminate) the cause of the error.

the way of granting unlimited rights to the user on whose behalf the http-server is running is incorrect and dangerous.


if you are aware of this and agree with the security hole, you can provide the user, on whose behalf the http server is running (probably www-data ), the right to execute the necessary command as the root user without entering a password.

To do this, add the following line to /etc/sudoers (it should be edited using the visudo program):

 www-data ALL=NOPASSWD: /путь/к/программе 

then, on behalf of this user, it will be possible to execute a command of the form:

 $ sudo /путь/к/программе [опции|параметры]