没有不值得去解决的问题,也没有不值得去学习的技术!

Fixing the “proc_open Is Not Available on Your PHP Installation” Error When Jenkins Builds Images

Because yiisoft/yii2-composer (2.0.7) could not be downloaded from dist, it now attempts to download from source. The Process class relies on proc_open, which is not available on your PHP installation

1. Because yiisoft/yii2-composer (2.0.7) could not be downloaded from dist, it now attempts to download from source. The Process class relies on proc_open, which is not available on your PHP installation, as shown in Figure 1.

Because yiisoft/yii2-composer (2.0.7) could not be downloaded from dist, it now attempts to download from source. The Process class relies on proc_open, which is not available on your PHP installation
Figure 1

2. Edit the Dockerfile to remove proc_open and proc_close from disable_functions.

Dockerfile

FROM registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx112-php71:0.2.4

MAINTAINER wjtester@sobey.com

RUN sed -i 's/open_basedir = .\/:\/sobey:\/tmp:\/data:\/webtv/;open_basedir = .\/:\/sobey:\/tmp:\/data:\/webtv:\/usr\/local\/php/g' /usr/local/php/etc/php.ini && \
    sed -i 's/allow_url_fopen = Off/allow_url_fopen = On/g' /usr/local/php/etc/php.ini && \
    sed -i 's/disable_functions = exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show/disable_functions = system,passthru,shell_exec,escapeshellarg,escapeshellcmd,dl,popen,show/g' /usr/local/php/etc/php.ini

COPY code /sobey/www/pcs-api
COPY code/build/c_files/ /

RUN chown -R nginx:nginx /sobey/www/ && \
    rm -rf /etc/nginx/conf.d/status.conf && \
    chmod +x /usr/local/bin/composer && \
    cd /sobey/www/pcs-api && \
    composer install

3. Previously, proc_open and proc_close were also disabled, but the build worked fine. This was because yiisoft/yii2-composer (2.0.6) could be downloaded normally from dist, so it would not download from source and thus would not use proc_open or proc_close, as shown in Figure 2.

Previously, proc_open and proc_close were also disabled, but the build worked fine. This was because yiisoft/yii2-composer (2.0.6) could be downloaded normally from dist, so it would not download from source and thus would not use proc_open or proc_close
Figure 2

4. Rebuild the image; the download from source succeeds and the build completes successfully, as shown in Figure 3.

Rebuild the image; the download from source succeeds and the build completes successfully
Figure 3

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系