Skip to content

PHP8.1 segfaults on linting #83

Open

Description

@markvds

I don't know whether this happens on all platforms, but on my Fedora 37 host machine, PHP CLI segfaults when linting a file (part of our pre-commit hook) on the latest Hypernode Docker (PHP 8.1.12):

# php -v
PHP 8.1.12 (cli) (built: Oct 28 2022 17:32:24) (NTS)
[...]
# echo "<?php phpinfo();" | php -l
Segmentation fault (core dumped)

The problem arises only on PHP 8.1, only when linting (as far as I have seen) and only on the latest Hypernode Docker.

I hope this problem is over with a new PHP (patch) release, but it would also be nice to know if others experience the same problem.

Activity

  1. tdgroot commented on May 4, 2023

    @tdgroot
    Member

    Hi Mark,

    Thanks for reporting the problem. We're going to look into this and let you know once it's fixed!

  2. markvds commented on May 15, 2023

    @markvds
    Author

    Update: I just noticed a new Hypernode Docker release. I assumed that updating PHP 8.1 would solve the problem, but unfortunately it din't.

    # php -v
    PHP 8.1.18 (cli) (built: Apr 14 2023 04:26:30) (NTS)
    [...]
    # echo "<?php phpinfo();" | php -l
    Segmentation fault (core dumped)
    

    The rest of the situation hasn't changed: any other available PHP version just works. And to be complete: this problem only arises in the Docker environment, not on live Hypernode environments and also my host machine (which also runs on 8.1.18) has no problems.

    I'd be happy to help, but I don't really know where to start :(

  3. markvds commented on May 15, 2023

    @markvds
    Author

    Apparently, I did know where to start :-)

    Disabling the opcache.so module in cli config (I just removed the symlink /etc/php/8.1/cli/conf.d/10-opcache.ini) seems to solve the issue.

    This will probably have a minor effect on CLI performance, but I don't think anyone will even notice the difference on their development environment.

  4. tdgroot commented on May 17, 2023

    @tdgroot
    Member

    Hi @markvds! Great to hear you have found an intermediate solution :).

    In the Docker images we have ionCube enabled by default and we've found that in this specific case it conflicts with opcache. We have disabled ionCube for the PHP 8.1 images, so now it should work out of the box!

    $ docker run -it docker.hypernode.com/byteinternet/hypernode-buster-docker-php81-mysql80:latest bash -c 'echo "<?php phpinfo();" | php -l'
    Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
    No syntax errors detected in Standard input code
  5. markvds commented on May 17, 2023

    @markvds
    Author

    Thanks for the update! It's something that has been on my to do list for a while now, to disable ionCube by default for our own implementation of the Docker image. We have no customers that use ionCube. A good motivation to finally do this! :-)

    As a sidenote: We only have one image that switches php versions while booting. @tdgroot Have you disabled it in the php8.1 configuration of all images (in /etc/php8.1/*/conf.d/), or specifically in the php8.1 images?

  6. markvds commented on Sep 3, 2024

    @markvds
    Author

    Update: It seems that PHP 8.2 has the exact same problem. It segfaults on linting.

    Because we now have a customer that actually uses ionCube (for uRapidflow), disabling ionCube was not an option anymore.

    For people running into the same problem: Disable opcache in PHP CLI configuration by removing the symlink in /etc/php/8.x/cli/conf.d/10-opcache.ini (where x is the minor PHP version) and you're done! It will definitely have some impact on your CLI performance, but personally I didn't notice any difference.

    We added these lines to our own Dockerfile:

    # PHP 8.1 & PHP 8.2 Segfault on linting. Disabling opcache module seems to solve the problem.
    RUN rm -f /etc/php/8.1/cli/conf.d/10-opcache.ini
    RUN rm -f /etc/php/8.2/cli/conf.d/10-opcache.ini
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions