proc_open 在 whitelist_functions 中,但在 App Engine 中不可用

proc_open is in whitelist_functions but not available in App Engine

我正在尝试使用自定义 PHP 运行 时间将 Laravel 应用程序部署到 App Engine 柔性环境。 当我尝试在网站上生成 PDF 时(使用 wkhtmltopdf 和 laravel-snappy 包装器)我收到错误: (1/1) 逻辑异常

The Process class relies on proc_open, which is not available on your PHP installation.
in Process.php line 143 
at Process->__construct(array(), null, null, null, 60.0)in Process.php line 195
at Process::fromShellCommandline('/app/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality \'/tmp/knp_snappy5dc8497d489631.19576754.html\' \'/tmp/knp_snappy5dc8497d489f90.93505253.pdf\'', null, null)in AbstractGenerator.php line 520
at AbstractGenerator->executeCommand('/app/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality \'/tmp/knp_snappy5dc8497d489631.19576754.html\' \'/tmp/knp_snappy5dc8497d489f90.93505253.pdf\'')in AbstractGenerator.php line 176

不过,我的 app.yaml.

中的 whitelist_functions 行中列出了 proc_open 和 proc_closed

这是我的 app.yaml 的片段:

runtime:         custom
env:             flex
api_version:    1

runtime_config:
  document_root:  public
  whitelist_functions: proc_open,proc_close

为了尝试其他方法,我也尝试将其包含在 php.ini:

google_app_engine.enable_functions = "php_sapi_name,php_uname,getmypid,proc_open, proc_close"
google_app_engine.disable_functions ="exec,passthru,shell_exec,show_source,symlink,system"

但是还是出现上面的错误

如果相关,我还会展示我的 Dockerfile:

FROM gcr.io/google-appengine/php

COPY ./ /app
RUN mkdir -p /app/storage/framework/cache \
    mkdir -p /app/storage/framework/cache/data \
    mkdir -p /app/storage/framework/views \
    mkdir -p /app/storage/framework/sessions \
    mkdir -p /app/storage/logs
RUN chmod -R a+rwX /app/storage
RUN chmod a+rwx /app/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64
ENV DOCUMENT_ROOT /app/public

RUN apt-get update && apt-get -y install libfontconfig1 libxrender1 libxext6 libssl-dev libssl1.0 libjpeg62 libpng16-16

EXPOSE 8080

...以及我的 composer.json:

中的相关位
"require": {
    "php": ">=7.2.9",
    "laravel/framework": "^6.0",
    "google/cloud": "^0.24.0",
    "superbalist/laravel-google-cloud-storage": "^2.0",
    "barryvdh/laravel-snappy": "^0.4.3",
    "h4cc/wkhtmltopdf-amd64": "0.12.x",
    "h4cc/wkhtmltoimage-amd64": "0.12.x"
},

我是不是漏掉了什么?

更新: 我不确定这是否相关,或者只是我下一步需要处理的另一个错误,但如果我尝试 运行 wkhtmltopdf 直接从命令行,我得到 error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory 但我无法安装它,因为它似乎不适用于我正在使用的 Linux 版本 (Ubuntu 16.04.6)。

你可以查看这个例子:How to use the image on App Engine Flexible Environment

If you need any of those functions, you can add an environment variable WHITELIST_FUNCTIONS.

app.yaml:

runtime: php
vm: true
api_version: 1

env_variables:
  WHITELIST_FUNCTIONS: phpinfo,exec