There were several topics similar to mine, but they did not help me. Perhaps something new will come.
Problem: I cannot execute the PHP wkhtmltopdf form. My main code is:
exec('wkhtmltopdf http://somesite.com /home/user/file.pdf');
Now a few things I already checked:
- the same command works when launched from the console
- safe_mode is disabled - I can execute commands in PHP, for example it
exec('ls');works fine - you can find the path to wkhtmltopdf, and I can run the program myself, for example, it
exec('wkhtmltopdf -V');works fine and displays version information - the output path is writable, it has 777 permissions and
exec('wkhtmltopdf -V > /home/user/file.pdf');works fine, it creates a file and puts version information inside - running with PHP, has access to the Internet, for example, it
exec('wget -O /home/user/file.pdf http://somesite.com')works fine, it extracts the source of the site and puts it in a file - replacing exec with passthru, shell_exec, etc. irrelevant
Conclusion: I can execute wkhtmltopdf, I can access the Internet, I can write a specific file, but the correct conversion command does not work and returns status 1.
I am using the latest version of Ubuntu, PHP version 5.3.10-1ubuntu3, version wkhtmltopdf 0.9.9. I tried this also on another machine with the same results.
Any ideas (just ANY) will be very grateful!
source
share