Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Symfony2应用程序中访问/wkhtmltox/bin/wkhtmltopdf_Symfony_Wkhtmltopdf_Ovh - Fatal编程技术网

如何在Symfony2应用程序中访问/wkhtmltox/bin/wkhtmltopdf

如何在Symfony2应用程序中访问/wkhtmltox/bin/wkhtmltopdf,symfony,wkhtmltopdf,ovh,Symfony,Wkhtmltopdf,Ovh,我在Symfony2应用程序中使用KNPNAPybundle生成PDF。 它在我的本地wamp上运行良好,配置如下: binary: "\"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe\"" binary: %kernel.root_dir%/../wkhtmltox/bin/wkhtmltopdf 我尝试使用该应用程序,但使用根目录下带有wkhtmltox的文件夹,配置如下: binary: "\"C:\\

我在Symfony2应用程序中使用KNPNAPybundle生成PDF。 它在我的本地wamp上运行良好,配置如下:

binary:     "\"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe\""
binary:     %kernel.root_dir%/../wkhtmltox/bin/wkhtmltopdf
我尝试使用该应用程序,但使用根目录下带有wkhtmltox的文件夹,配置如下:

binary:     "\"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe\""
binary:     %kernel.root_dir%/../wkhtmltox/bin/wkhtmltopdf
它不起作用。它会收到以下消息:

The exit status code '127' says something went wrong:
stderr: "sh: wkhtmltox/bin/wkhtmltopdf: No such file or directory
"
stdout: ""
command: wkhtmltox/bin/wkhtmltopdf --lowquality 
'/tmp/knp_snappy595a4fa89a6676.24945632.html' 
'/tmp/knp_snappy595a4fa89a6a59.72414975.pdf'.

我正在使用OVH的webhosting服务器。

您可以尝试从安装wkhtmltopdf

需要i386的软件包,包括:

作曲家需要h4cc/wkhtmltopdf-i386“0.12.3”

对于amd64,具有:

作曲家需要h4cc/wkhtmltopdf-amd64“0.12.3”

然后二进制文件将位于:

vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386

对于后者,services.yml将如下所示:

knp_snappy:
    pdf:
        enabled:    true
        binary:     '%kernel.root_dir%/../vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'
        options:    []

    temporary_folder: '%kernel.cache_dir%/snappy'

通过将其安装在供应商文件夹中,您将不再依赖于运行应用程序的计算机。

您可以尝试从安装wkhtmltopdf

需要i386的软件包,包括:

作曲家需要h4cc/wkhtmltopdf-i386“0.12.3”

对于amd64,具有:

作曲家需要h4cc/wkhtmltopdf-amd64“0.12.3”

然后二进制文件将位于:

vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386

对于后者,services.yml将如下所示:

knp_snappy:
    pdf:
        enabled:    true
        binary:     '%kernel.root_dir%/../vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'
        options:    []

    temporary_folder: '%kernel.cache_dir%/snappy'

通过将其安装到供应商文件夹中,您将不再依赖于运行应用程序的机器。

我通过谷歌搜索找到了这篇文章,因此我将发布我的解决方案,以防它对其他人有所帮助

KNP Snappy在我的例子中运行的命令是
vendor/h4cc/wkhtmltopf-i386/bin/wkhtmltopf-i386
,我从中得到了相同的“没有这样的文件或目录”错误

我很困惑,因为我可以看到这个文件,它是可执行的:

$ ls -al vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386 
-rwxr-xr-x 1 1000 1000 41424004 Nov  7 09:07 vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386
但是当我试着运行它的时候

$ vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386 
-bash: vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386: No such file or directory
我感到困惑,因为似乎错误在于可执行文件不存在,而且它显然确实存在

事实上,问题是我试图使用32位版本的可执行文件,而我的机器是64位的:

$uname -a
Linux mybox 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linux
(参见
amd64
部分)

因此,我必须更新config.yml中的这一位:

knp_snappy:
    pdf:
        binary: # this was the path to the 32-bit executable; I had to update it to use the 64-bit version.

我通过谷歌搜索找到了这篇文章,所以我发布了我的解决方案,以防它能帮助别人

KNP Snappy在我的例子中运行的命令是
vendor/h4cc/wkhtmltopf-i386/bin/wkhtmltopf-i386
,我从中得到了相同的“没有这样的文件或目录”错误

我很困惑,因为我可以看到这个文件,它是可执行的:

$ ls -al vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386 
-rwxr-xr-x 1 1000 1000 41424004 Nov  7 09:07 vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386
但是当我试着运行它的时候

$ vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386 
-bash: vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386: No such file or directory
我感到困惑,因为似乎错误在于可执行文件不存在,而且它显然确实存在

事实上,问题是我试图使用32位版本的可执行文件,而我的机器是64位的:

$uname -a
Linux mybox 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linux
(参见
amd64
部分)

因此,我必须更新config.yml中的这一位:

knp_snappy:
    pdf:
        binary: # this was the path to the 32-bit executable; I had to update it to use the 64-bit version.

谢谢你的帮助。现在我有以下消息:退出状态代码“126”表示出现了问题:stderr:“sh:/home/procontakq/Configurateur/app/。/vendor/h4cc/wkhtmltopf-amd64/bin/wkhtmltopf-amd64:权限被拒绝…在这里找到了答案:我很高兴您找到了权限问题的答案。我很忙,所以无法分析你的问题。现在一切都好了吗?不,不好了。。。对不起,我迟了答复。我正忙着做其他事情……我发现所需的库并不是全部安装在共享服务器上。我对此无能为力……谢谢你的帮助。现在我有以下消息:退出状态代码“126”表示出现了问题:stderr:“sh:/home/procontakq/Configurateur/app/。/vendor/h4cc/wkhtmltopf-amd64/bin/wkhtmltopf-amd64:权限被拒绝…在这里找到了答案:我很高兴您找到了权限问题的答案。我很忙,所以无法分析你的问题。现在一切都好了吗?不,不好了。。。对不起,我迟了答复。我正忙着做其他事情……我发现所需的库并不是全部安装在共享服务器上。我对此无能为力。。。。