CakePHP在使用CakePdf插件时找不到“wkhtmltopdf” [英] CakePHP can't find 'wkhtmltopdf' when using CakePdf plugin
问题描述
我被困在一个已经被困扰的问题上。我已按照自述文件中的说明安装了 CakePdf插件。当我使用插件,但是,我得到一个CakePHP错误,说如下:
I'm stuck on a problem which has got be stumped. I've installed the CakePdf plugin as per the instructions in the Read Me file. When I get to use the plugin however, I get a CakePHP error saying the following:
Pdf enginewkhtmltopdf找不到
Pdf engine "wkhtmltopdf" not found
错误:发生了内部错误。堆栈跟踪
Error: An Internal Error Has Occurred. Stack Trace
APP/Plugin/CakePdf/Pdf/CakePdf.php line 193 → CakePdf->engine(string)
APP/Plugin/CakePdf/View/PdfView.php line 74 → CakePdf->__construct(array)
APP/Plugin/CakePdf/View/PdfView.php line 64 → PdfView->renderer(array)
CORE/Cake/Controller/Controller.php line 942 → PdfView->__construct(UsersController)
CORE/Cake/Routing/Dispatcher.php line 193 → Controller->render()
CORE/Cake/Routing/Dispatcher.php line 161 → Dispatcher->_invoke(UsersController, CakeRequest, CakeResponse)
APP/webroot/index.php line 96 → Dispatcher->dispatch(CakeRequest, CakeResponse)
我检查了CakePdf使用的二进制路径,这是以下代码:
I've checked the binary path that CakePdf uses, and this is the following code:
protected $binary = '/usr/bin/wkhtmltopdf';
我已经导航到/ usr / bin /目录,wkhtmltopdf二进制文件。我也使用命令 wkhtmltopdf http://bbc.co.uk bbc.pdf
,它的工作原理。所以我不知道为什么CakePHP / CakePdf找不到插件,即使它位于定义的二进制路径?
I've navigated to the /usr/bin/ directory, and the wkhtmltopdf binary is there. I've also used the command wkhtmltopdf http://bbc.co.uk bbc.pdf
and it works. So I don't know why CakePHP/CakePdf can't find the plugin, even though it is located in the defined binary path?
更新
以下是 wkhtmltopdf
二进制文件的权限等:
Update
Here is the permissions etc for the wkhtmltopdf
binary:
-rwxrwxrwx。 1 root root 8301444 Aug 27 08:14 wkhtmltopdf
-rwxrwxrwx. 1 root root 8301444 Aug 27 08:14 wkhtmltopdf
推荐答案
在bootstrap.php文件中调用 wkhtmltopdf
,而不是使用:
When you call wkhtmltopdf
in the bootstrap.php file, instead of using:
'engine' => 'WkHtmlToPdf'
您需要使用:
'engine' => 'CakePdf.WkHtmlToPdf'
。
然后修复问题。
这篇关于CakePHP在使用CakePdf插件时找不到“wkhtmltopdf”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!