Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Dockerfile from PHP 7.4 to PHP 8.0 #49

Open
johnnieclapper opened this issue Oct 12, 2021 · 1 comment
Open

Upgrade Dockerfile from PHP 7.4 to PHP 8.0 #49

johnnieclapper opened this issue Oct 12, 2021 · 1 comment

Comments

@johnnieclapper
Copy link

Hey there, this Dockerfile was a great starting point for my use case. Thank you for that!

Nevertheless I was forced to upgrade php because some of my project dependencies needed php 8.0.
Fortunately GRAV 1.7.x perfectly runs with php 8.0.

In case anybody has to match the same requirements I'm sharing my experience with you. Maybe it helps.

What I did:

1. Change PHP Version

In first line of Dockerfile I simply changed the image FROM php:7.4-apache to FROM php:8.0-apache. That's the beauty of the php docker image.

2. Build fails

Then you get an error during build for pecl install apcu:

RUN pecl install apcu \
    && pecl install yaml-2.0.4 \
    && docker-php-ext-enable apcu yaml

The reason should be the following:
√php-apcu-bc: This can be dropped, nothing depends on it any longer.: https://wiki.ubuntu.com/ServerTeam/Transition/Php8.0

I simply commented the lines out.

3. Add JIT

Everything seems to be working fine but I'm wondering if in matters of performance it makes sense to enable JIT in PHP 8.0. Therefore I added two JIT settings at the end of ini settings. Not tested jet if it really improves performance.:

## Set recommended PHP.ini settings
## See https://secure.php.net/manual/en/opcache.installation.php
RUN { \
    echo 'opcache.memory_consumption=128'; \
    echo 'opcache.interned_strings_buffer=8'; \
    echo 'opcache.max_accelerated_files=4000'; \
    echo 'opcache.revalidate_freq=2'; \
    echo 'opcache.fast_shutdown=1'; \
    echo 'opcache.enable_cli=1'; \
    echo 'upload_max_filesize=128M'; \
    echo 'post_max_size=128M'; \
    echo 'expose_php=off'; \
    echo 'opcache.jit_buffer_size=100M'; \
    echo 'opcache.jit=1235'; \
    } > /usr/local/etc/php/conf.d/php-recommended.ini

Can anybody give me feedback if I'm doing it right? And maybe my suggestions are useful for future updates of this repository. It seems that in the future GRAV will make the step to php 8.0 as a minimum requirement (https://getgrav.org/blog/raising-php-requirements-2020).

Have a great day,

Johnnie

@johnnieclapper johnnieclapper changed the title Just suggesting to upgrade PHP 7.4 to PHP 8.0 Upgrade PHP 7.4 to PHP 8.0 Oct 12, 2021
@johnnieclapper johnnieclapper changed the title Upgrade PHP 7.4 to PHP 8.0 Upgrade Dockerfile from PHP 7.4 to PHP 8.0 Oct 12, 2021
@stsimb
Copy link

stsimb commented Jan 24, 2022

Hi @johnnieclapper, thanks for your work!

Everything seems to be working fine but I'm wondering if in matters of performance it makes sense to enable JIT in PHP 8.0. Therefore I added two JIT settings at the end of ini settings. Not tested jet if it really improves performance.:

    echo 'opcache.jit_buffer_size=100M'; \
    echo 'opcache.jit=1235'; \

Can anybody give me feedback if I'm doing it right?

You also need to add
echo 'opcache.enable=1'; \
to make it work (ref: https://stitcher.io/blog/php-8-jit-setup).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants