Search code examples
phpdockerphp-7.2opcache

How to enable optimizations in opcache (in an official php-fpm docker image)


The container is built from a trivial Dockerfile:

FROM php:7.2.19-fpm

RUN docker-php-ext-configure opcache --enable-opcache \
    && docker-php-ext-install opcache

I did not change php.ini, so all the settings are default.

What's unexpected is that now phpinfo shows (the excerpt):

Opcode Caching  Up and Running
Optimization    Disabled
SHM Cache   Enabled
File Cache  Disabled

opcache.enable  On  On
opcache.optimization_level  0   0x7FFFBFFF

The question: what else do I need to do to have optimisations enabled?


Solution

  • Well, my apologies, I over-simplified the question to a degree when it's impossible to answer it. I'm really sorry for that.

    The real reason it's not enabled is because xdebug is installed and enabled as well.