如何让 wkhtmltopdf 在 cPanel 共享主机上运行 Drupal 站点?

发布于 2024-09-24 12:32:21 字数 2159 浏览 7 评论 0原文

首先,我承认我知道关于 wkhtmltopdf 主题的另一个类似线程,但它不够相似,不足以解决我的问题。这是另一个线程: wkhtmltopdf

其次,我会说我已经成功地将 wkhtmltopdf 与我运行的专用服务器上的 Drupal 站点一起使用,我在其中安装了 libX11 并使用了 wkhtmltopdf 的最新静态版本。这是在 CentOS 5 系统上运行的,运行良好。

因此,我有另一个托管安排,我需要让 wkhtmltopdf 工作,因为它在生成带书签的 PDF 方面做得非常出色。 PDF 很漂亮。

托管是cPanel。我确定它位于具有 CentOS 5.5 的服务器上。将静态 wkhtmltopdf 放入打印模块的 lib 文件夹中不是问题。但是,我在 Drupal 管理状态报告页面 (admin/reports/status) 中收到以下消息。

它说, “wkhtmltopdf 库 不支持当前选择的 wkhtmltopdf () 版本。请更新到较新的版本。”

我已经获得了 CentOS 5 所需的所有 .so 文件,基于 jockie 在另一个 StackOverflow 线程的回答中提供了什么

有知识的人可以确认他的列表是完整的吗?

shell 脚本包装器 看起来很有趣,如果 shell 脚本的命名类似于“wkhtmltopdf”,那么似乎可以为 Drupal 完成 -wrapper.sh”。

我尝试在 shell 脚本中使用 jockie 提供的 shell 脚本代码。我确实将所有 .so 文件放在名为“lib”的子文件夹中。我承认我不知道这些东西在脚本中意味着什么:

export HOME="$PWD"

有人能为我解释一下 $PWD 意味着什么吗?

export LD_LIBRARY_PATH="$PWD/lib/"

我知道脚本将使用该行获取 .so 文件,是吗?

有人可以解释以下行:

exec $@ 2>/dev/null

我想知道的是,实际的 pdf 从哪里输出?我确实运行了脚本。它没有抛出任何错误。但是,我没有看到生成的 PDF 文件。

此外,骑师的指示并不完全清晰或明确。他在 .so 文件列表下说“(其中一些是符号链接)”。这些行(在他的列表中)是符号链接吗?:

lib/libX11.so.6 lib/libX11.so.6.2.0

或者我错了?我能够获得所有这些,所以我不知道为什么它们会是符号链接。唯一的问题是,有些版本不同。我是否需要删除以下文件并改为创建符号链接?:

  • lib/libX11.so.6
  • lib/libXau.so.6
  • lib/libxcb.so.1
  • lib/libXext.so.6

考虑到 Drupal,shell 脚本代码是否应该以不同的方式编写?

感谢您的阅读,希望有人能提供帮助!

...最后,如果有人知道更好的解决方案,请分享!再次感谢您的帮助!

...在 StackOverflow.com 上似乎没有办法通知 jockie 查看此线程。我希望有一种方法可以写信给他们或通知他们,以便他们可以自己澄清或为这个帖子做出贡献。如果有人知道方法,也请告诉我!

First off, I will acknowledge that I am aware of another similar thread on the topic of wkhtmltopdf, but it was not similar enough to resolve my issue. Here's the other thread: wkhtmltopdf

Second, I will say that I have successfully used wkhtmltopdf with a Drupal site on a dedicated server that I run, where I installed the libX11 and used the most recent static version of wkhtmltopdf. That's on a CentOS 5 system and it runs nicely.

So, I have another hosting arrangement and I need to get the wkhtmltopdf to work, because it does the most amazing job producing bookmarked PDFs. The PDFs are beautiful.

The hosting is cPanel. I determined that it is on a server that has CentOS 5.5. It is not a problem to drop the static wkhtmltopdf in the print module's lib folder. However, I get the following message back in the Drupal admin status reports page (admin/reports/status).

It says,
"wkhtmltopdf library
The currently selected version of wkhtmltopdf () is not supported. Please update to a newer version."

I have obtained all of the needed .so files for CentOS 5, based on what jockie provided in his answer in the other StackOverflow thread.

Can someone knowledgeable confirm that his list was complete?

The idea of a shell script wrapper seems interesting and appears could be done for Drupal, if the naming of the shell script is called something like "wkhtmltopdf-wrapper.sh".

I have tried to use the shell script code that jockie provided, in a shell script. I did place all of the .so files in a sub-folder called "lib". I confess that I do not know what such things mean, in the script:

export HOME="$PWD"

Can someone interpret for me, what $PWD means?

export LD_LIBRARY_PATH="$PWD/lib/"

I understand that the script is going to get the .so files with that line, yes?

And can someone interpret the following line:

exec $@ 2>/dev/null

What I am wondering is, where does the actual pdf get output? I did run the script. It did not throw any errors. However, I did not see a resulting PDF file.

Also, jockie's directions are not totally clear or defined enough. He says, "(some of them are symlinks)" under the list of .so files. Are such lines (in his list), the symlinks?:

lib/libX11.so.6 lib/libX11.so.6.2.0

Or am I mistaken? I was able to get all of them, so I don't know why they would be symlinks. The only thing is, that some of the versions are different. Do I need to delete the following files and make symlinks instead?:

  • lib/libX11.so.6
  • lib/libXau.so.6
  • lib/libxcb.so.1
  • lib/libXext.so.6

Should the shell script code be written differently, with Drupal in mind?

Thanks for reading and I hope someone can help!

...Finally, if anyone knows of a better solution, please share! Again, I appreciate the help!

...There does not seem to be a way, here on StackOverflow.com to notify jockie to check out this thread. I wish there was a way to write to them or notify them, so that they could clarify for them-self or contribute to this thread as well. If someone knows of a way, please let me know that too!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文