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

我正在尝试使用自定义PHP运行时将Laravel应用程序部署到App Engine Flexible环境。 当我尝试在网站上生成PDF时(使用laravel-snappy包装器使用wkhtmltopdf)时出现错误:  (1/1)LogicException

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,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)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)。

chitow 回答:proc_open在whitelist_functions中,但在App Engine中不可用

您可以检查以下示例:How to use the image on App Engine Flexible Environment

  

如果需要任何这些功能,则可以添加环境   变量WHITELIST_FUNCTIONS。

app.yaml:

runtime: php
vm: true
api_version: 1

env_variables:
  WHITELIST_FUNCTIONS: phpinfo,exec
本文链接:https://www.f2er.com/3128120.html

大家都在问