我想使用wkhtmltopdf进行HTML到PDF的转换。wkhtmltopdf不能在php脚本中工作
当我试图通过linux终端进行转换时,它工作正常。
但是,当我用PHP脚本尝试它不起作用。
我想直接执行二进制文件。
这里是我想用PHP的代码。
exec('/home/binary_loc/wkhtmltopdf http://www.google.com /home/user/output.pdf');
我的二进制文件位于“index.php”存在的相同文件夹中。
我试图用PHP获取wkhtmltopdf二进制文件的版本,然后它返回版本。
但我不明白为什么不能用pdf执行pdf。
这是使用php进行版本检查的代码。
error_reporting(E_ALL);
ini_set('display_errors', '1');
$cmd = "./wkhtmltopdf --version";
$t = shell_exec($cmd);
echo $t;
exit()
有没有人有解决方案?
我想要这个,因为这也可以在共享主机中工作。无需在服务器中安装wkhtmltopdf。
你检查了二进制的系统位,像32或64 – 2014-09-24 13:54:52
是的,我已经检查过它。它的32位 – user3305818 2014-09-25 07:33:48