【问题标题】:exec: "php-fpm": executable file not found in $PATH: unknownexec:“php-fpm”:在 $PATH 中找不到可执行文件:未知
【发布时间】:2021-02-07 09:06:47
【问题描述】:

为 laravel 项目运行 docker-compose up -d 时出现以下错误。

ERROR: for groshop_laravel-env_1  Cannot start service laravel-env: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "php-fpm": executable file not found in $PATH: unknown

ERROR: for laravel-env  Cannot start service laravel-env: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "php-fpm": executable file not found in $PATH: unknown
ERROR: Encountered errors while bringing up the project.

我的 dockerFile 看起来像

FROM centos:7

# Install some must-haves
RUN yum -y install vim wget sendmail
RUN yum -y install libtool make automake autoconf nasm libpng-static
RUN yum -y install git
RUN git --version

# Install PHP 7.1 on CentOS
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
    && rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
RUN yum install yum-utils
RUN yum install epel-release
RUN yum-config-manager --enable remi-php73

RUN yum --enablerepo=remi-php73 -y install php php-bcmath php-cli php-common php-gd php-intl php-ldap php-mbstring \
    php-mysqlnd php-pear php-soap php-xml php-xmlrpc php-zip

RUN php -v

# Prepare PHP environment
COPY config/php/php-fpm.conf /etc/php-fpm.conf
COPY config/php/www.conf /etc/php-fpm.d/www.conf
COPY config/php/php.ini /usr/local/etc/php/php.ini
COPY config/php/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/bin/composer
RUN composer --version

# Install Node.js
RUN curl -sL https://rpm.nodesource.com/setup_7.x | bash -
RUN yum -y install nodejs
RUN yum list installed nodejs
RUN node -v

# Final update and clean up
RUN yum -y update --skip-broken
RUN yum clean all

# Define work directory
WORKDIR /var/www/laravel-boilerplate

# Expose ports
EXPOSE 9000

# CMD ["php-fpm", "-F", "-O"]
CMD ["php-fpm", "-F"] 

我在配置下也有 php 文件。已尝试更改 CMD 行,但没有运气。 任何的想法? 我看到的另一个观察结果是,我看不到 /etc 下的那些 php-fpm.* 文件,但只有包含以下内容的 supervisord.conf 文件。

[supervisord] nodaemon=true

[程序:php-fpm] 命令=/usr/sbin/php-fpm -F -R 用户=root autostart = true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0

【问题讨论】:

    标签: php docker centos7


    【解决方案1】:

    我无法发现正在安装的 php-fpm 软件包。

    RUN yum --enablerepo=remi-php73 -y install php php-bcmath php-cli php-common php-gd php-intl php-ldap php-mbstring \
        php-mysqlnd php-pear php-soap php-xml php-xmlrpc php-zip php-fpm
    

    【讨论】:

    • 你也可以删除“php”包(即“mod_php”,如果你使用FPM则不需要)
    猜你喜欢
    • 1970-01-01
    • 2022-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多