【问题标题】:Laravel 5.5 - Laravel-Snappy PDF Generation -> RuntimeException due to UnknownNetworkErrorLaravel 5.5 - Laravel-Snappy PDF 生成 -> RuntimeException 由于 UnknownNetworkError
【发布时间】:2019-04-04 22:39:59
【问题描述】:

我正在使用 5.5 的框架,最近下载了 wkhtmltopdf-amd64 包的 0.12.5 (dev-master) 来尝试解决这个错误。

我知道这通常是由于 html 中的 SSL (https) url,但我已经得到了我试图打印的文件,并且它在我的生产环境中可以使用。

我将测试环境中的新代码(已修改为使用 font awesome 5)改回来,使其仅使用 v4 版本。据我所知,文件中的链接(1 个有效,1 个无效)是相同的。

我的测试文件的 html 中是否还有其他问题会导致此处显示的错误:

(1/1) RuntimeException
The exit status code '1' says something went wrong:
stderr: "Loading pages (1/6)
[> ] 0%
[======> ] 10%
QSslSocket: cannot resolve CRYPTO_num_locks
QSslSocket: cannot resolve CRYPTO_set_id_callback
QSslSocket: cannot resolve CRYPTO_set_locking_callback
QSslSocket: cannot resolve sk_free
QSslSocket: cannot resolve sk_num
QSslSocket: cannot resolve sk_pop_free
QSslSocket: cannot resolve sk_value
QSslSocket: cannot resolve SSL_library_init
QSslSocket: cannot resolve SSL_load_error_strings
QSslSocket: cannot resolve SSLv3_client_method
QSslSocket: cannot resolve SSLv23_client_method
QSslSocket: cannot resolve SSLv3_server_method
QSslSocket: cannot resolve SSLv23_server_method
QSslSocket: cannot resolve X509_STORE_CTX_get_chain
QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
QSslSocket: cannot resolve SSLeay
QSslSocket: cannot call unresolved function CRYPTO_num_locks
QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function sk_num
[========> ] 14%
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
Warning: Failed to load https://mcentric-test.herokuapp.com/css/jumbotron.css (ignore)
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
Warning: Failed to load https://mcentric-test.herokuapp.com/images/mCentric_logo.png (ignore)
Warning: Failed to load https://mcentric-test.herokuapp.com/images/meeting.jpg (ignore)
Warning: Failed to load https://mcentric-test.herokuapp.com/images/outlook.jpg (ignore)
Warning: Failed to load https://mcentric-test.herokuapp.com/images/google.jpg (ignore)
Warning: Failed to load https://mcentric-test.herokuapp.com/images/yahoo.jpg (ignore)
Warning: Failed to load https://mcentric-test.herokuapp.com/images/ical.jpg (ignore)
Warning: Failed to load https://mcentric-test.herokuapp.com/images/mCentric_logo_blue.png (ignore)
[============================================================] 100%
Counting pages (2/6) 
[============================================================] Object 1 of 1
Resolving links (4/6) 
[============================================================] Object 1 of 1
Loading headers and footers (5/6) 
Printing pages (6/6)
[> ] Preparing
[============================================================] Page 1 of 1
Done 
Exit with code 1 due to network error: UnknownNetworkError
QSslSocket: cannot call unresolved function CRYPTO_num_locks
QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
"
stdout: ""
command: /app/vendor/bin/wkhtmltopdf-amd64 --lowquality --load-error-handling 'ignore' '/tmp/knp_snappy5bd9df39f00ca0.32809410.html' '/tmp/knp_snappy5bd9df39f02363.36498894.pdf'.

in AbstractGenerator.php line 378

html produced from test server

html produced on production server (that does NOT error out) 重申一下,需要 6 个 https 链接进行格式化的外观确实使用 0.12.4 二进制文件成功创建了 PDF。

0.12.4 和 0.12.5 二进制文件(在测试环境中尝试时)都无法创建 PDF 并导致上面的错误文本。

【问题讨论】:

    标签: php laravel pdf-generation laravel-snappy


    【解决方案1】:

    【讨论】:

    • 请在您的答案中添加更多详细信息,因为链接可能会随着时间的推移而过时。
    【解决方案2】:

    我发布这个答案是为了让别人免于在未来不断审查这个问题。

    测试和生产环境是 Heroku 托管的环境。

    wkhtmltopdf-amd64 二进制文件在 cedar-14 堆栈(生产)上运行良好。

    测试环境的堆栈已升级,这似乎是它停止工作的原因。

    【讨论】:

      猜你喜欢
      • 2015-07-27
      • 1970-01-01
      • 1970-01-01
      • 2018-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-20
      • 2016-12-07
      相关资源
      最近更新 更多