Could not create PDF: sh: wkhtmltopdf: command not found

stefan picture stefan · Aug 12, 2014 · Viewed 7k times · Source

Just having some trouble with wkhtmltopdf. It works fine in command line but in PHP I keep getting this error:

Could not create PDF: sh: wkhtmltopdf: command not found.

It does work after a stop and restart of Apache, but it stops working after a couple of hours.

This is the current configuration:

phpwkhtmltopdf - latest version 
CentOS 5.10
wkhtmltopdf 0.12.1

Answer

stefan picture stefan · Sep 8, 2014

Everything seems to work amazing if I declare the binary as well..

$options = array( ...,"binary" => "/usr/local/bin/wkhtmltopdf")
$pdf = new Pdf($options);