gpt4 book ai didi

php - "symfony serve"使用 php 7.2 崩溃(docker/alpine)

转载 作者:行者123 更新时间:2023-12-02 18:00:43 25 4
gpt4 key购买 nike

我尝试构建并运行一个 docker 容器,但是 symfony serve进程启动后立即崩溃:

Jul 19 19:14:05 |INFO | PHP    listening path="/usr/local/sbin/php-fpm" php="7.2.20" port=43115
Jul 19 19:14:05 |DEBUG| PHP started
Jul 19 19:14:05 |DEBUG| PHP ERROR: cannot get uid for user '_www'
Jul 19 19:14:05 |DEBUG| PHP ERROR: FPM initialization failed

[OK] Web server listening on http://127.0.0.1:8000 (PHP FPM 7.2.20)


WARNING unable to find the application log
Jul 19 19:14:06 |DEBUG| PHP stopped
Jul 19 19:14:06 |INFO | SERVER shut down, bye!

PHP server exited unexpectedly: exit status 78

这是我的 Dockerfile :
FROM php:7.2-fpm-alpine

ENV COMPOSER_ALLOW_SUPERUSER 1

RUN apk update && apk upgrade && apk add bash

RUN wget https://get.symfony.com/cli/installer -O - | bash \
&& mv /root/.symfony/bin/symfony /usr/local/bin/symfony \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php --filename=composer \
&& php -r "unlink('composer-setup.php');" \
&& mv composer /usr/local/bin/composer

EXPOSE 8000

# Set working directory
WORKDIR /srv/api2/

# Copy source files
COPY bin bin/
COPY config config/
COPY public public/
COPY src src/
COPY .env ./
COPY composer.json composer.json symfony.lock ./

RUN mkdir -p var/cache var/logs \
&& composer install --prefer-dist --no-dev --optimize-autoloader --classmap-authoritative --no-scripts --no-progress --no-suggest \
&& composer dump-autoload --optimize --no-dev --classmap-authoritative \
&& composer clear-cache

CMD ["symfony", "serve", "--no-tls"]

最佳答案

解决您的问题的一个简单解决方案是对 Alpine 使用非 FPM PHP 镜像。

您可以替换:

FROM php:7.2-fpm-alpine

和:
FROM php:7.2-alpine

关于php - "symfony serve"使用 php 7.2 崩溃(docker/alpine),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57118529/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com