在docker php 7.3上启用APCU CLI

jmp7cifd  于 2023-09-29  发布在  PHP
关注(0)|答案(3)|浏览(159)

我正在尝试在我的docker容器上启用apcu cli,以便运行我的测试。这是我的docker文件,我用途:

  • 基本php图像
  • 安装composer
  • 安装xdebug
  • 安装更多Docker libs
  • 安装apcu

当我尝试在这个docker中运行我的测试时,由于apcu错误而失败。但是,在prod中,apcu工作良好,因为它已启用,但测试需要启用cli。

FROM php:7.3-cli

ARG APCU_VERSION=5.1.11

RUN apt-get update  && apt-get -y install git zip libzip-dev wget \
zlib1g-dev unzip libpq-dev git-core libmcrypt-dev vim libfcgi0ldbl gnupg \
libfreetype6-dev libjpeg62-turbo-dev libpng-dev libicu-dev

#INSTALL COMPOSER
RUN echo "memory_limit = -1" > /usr/local/etc/php/conf.d/memory_limit.ini
RUN curl -sS http://getcomposer.org/installer | php -- --filename=composer && chmod a+x composer  && mv composer /usr/local/bin/composer
RUN echo 'export PATH=~/.composer/vendor/bin:$PATH' >> ~/.bashrc
RUN composer global require hirak/prestissimo

#ENABLE DOCKER LIBS
RUN docker-php-ext-install zip pdo pdo_pgsql pgsql mbstring opcache -j$(nproc) gd
RUN docker-php-ext-configure intl && docker-php-ext-install intl
RUN docker-php-ext-configure opcache --enable-opcache
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/

#INSTALL XDEBUG
RUN pecl install xdebug-2.7.0RC1 && docker-php-ext-enable xdebug
#XDEBUG

#INSTALL APCU
RUN pecl install apcu-${APCU_VERSION} && docker-php-ext-enable apcu
RUN echo "extension=apcu.so" > /usr/local/etc/php/php.ini
RUN echo "apc.enable_cli=1" > /usr/local/etc/php/php.ini
RUN echo "apc.enable=1" > /usr/local/etc/php/php.ini
#APCU

RUN php --ini
RUN php --info | grep apc

#MAKE tmp WRITABLE
RUN chmod 777 -R /tmp && chmod o+t -R /tmp

但在最后,当我打印php信息时,结果是:

Additional .ini files parsed => /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini,
apcu
apc.coredump_unmap => Off => Off
apc.enable_cli => Off => Off
apc.enabled => On => On
apc.entries_hint => 4096 => 4096
apc.gc_ttl => 3600 => 3600
apc.mmap_file_mask => no value => no value
apc.preload_path => no value => no value
apc.serializer => php => php
apc.shm_segments => 1 => 1
apc.shm_size => 32M => 32M
apc.slam_defense => On => On
apc.smart => 0 => 0
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.writable => /tmp => /tmp
klsxnrf1

klsxnrf11#

抱歉
我的错...
如果你想在一个文件中添加一个字符串,你必须在echo line上使用>>
我希望这将有助于某人,问候

nfs0ujit

nfs0ujit2#

# Install APCu and APC backward compatibility
RUN pecl install apcu \
    && pecl install apcu_bc-1.0.3 \
    && docker-php-ext-enable apcu --ini-name 10-docker-php-ext-apcu.ini \
    && docker-php-ext-enable apc --ini-name 20-docker-php-ext-apc.ini
nwlqm0z1

nwlqm0z13#

只是

docker-php-ext-enable apc

docker-php-ext-enable apcu

相关问题