There have been a few topics similar to mine, but they did not help me. Maybe something new will come up.
Problem: I can't execute wkhtmltopdf form PHP.
My basic code is:
exec('wkhtmltopdf http://somesite.com /home/user/file.pdf');
Now a few things I already checked:
exec('ls');
works fineexec('wkhtmltopdf -V');
works fine and outputs versioning infoexec('wkhtmltopdf -V > /home/user/file.pdf');
works fine, creates the file and puts versioning info insideexec('wget -O /home/user/file.pdf http://somesite.com')
works fine, retrieves the site source and puts it into the fileConcluding: I can execute wkhtmltopdf, I can access internet, I can write the specific file, but a correct conversion command fails and returns status 1.
I use the latest Ubuntu, PHP Version is 5.3.10-1ubuntu3, wkhtmltopdf version is 0.9.9. I tried it also on some other machine with the same retults.
Any (just ANY) ideas will be greatly appreciated!
Add 2>&1
to the end of your command to understand the exact error.
exec('wkhtmltopdf http://somesite.com /home/user/file.pdf 2>&1');
This way it will tell you the error when running this under Apache. Once you know what's wrong, it is easier to address. I had a similar problem before with ImageMagick
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With