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

php drops mysqli plugin after several httpd reloads #175630

Open
JasonWoof opened this issue May 31, 2022 · 4 comments
Open

php drops mysqli plugin after several httpd reloads #175630

JasonWoof opened this issue May 31, 2022 · 4 comments

Comments

@JasonWoof
Copy link
Contributor

Describe the bug

after several times doing this: systemctl reload httpd
php no longer has mysqli support, i.e. it no longer shows in phpinfo() and functions like mysqli_report() are no longer defined.

Note the difference between "reload" and "restart".

Several reloads break it. One restart gets it working again.

Steps To Reproduce

Steps to reproduce the behavior:

  1. seq 1 40 | while read x; do systemctl reload httpd; done
  2. echo "<?php mysqli_report(0); print 'OK';" > /your/web/root/test.php
  3. curl http://localhost/test.php

Expected behavior

curl should output "OK".

The number of reloads it takes to break php+mysql varies. Perhaps it takes (on average) less reloads with a larger httpd.conf, so if you have trouble reproducing, perhaps try a few hundred reloads.

Please let me know if you have trouble reproducing and I'll work on creating a simpler test case where I can publish my full configuration.nix

Additional context

I have 24 virtualhosts configured, all with acme. I'm seeing an httpd reload on average about once per hour, so php breaks about once per day. I can see httpd reload with: systemctl status -n 200 httpd

I suspect that the acme timers are causing a lot of unnecessary httpd reloads, but that's a separate issue.

Notify maintainers

@winterqt @aanderse

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.43, NixOS, 22.05 (Quokka), 22.05.342.a634c8f6c1f`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.8.1`
 - channels(jasonwoof): `"nixos-21.11, nixpkgs"`
 - channels(root): `"nixos-22.05.342.a634c8f6c1f"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

This is running on a $5/month Linode.

Here's how I configure apache/php:

        enable = true;
        adminAddr = "webmaster@example.org";
        enablePHP = true;
        phpPackage = pkgs.php80.buildEnv {
            extensions = ({ enabled, all }: enabled ++ (with all; [
                mysqli
                gd
            ]));
            extraConfig = ''
                post_max_size = 250M
                upload_max_filesize = 200M
            '';
        };
    };

my 24 virtualhosts all have:

            addSSL = true;
            enableACME = true;
@aanderse
Copy link
Member

2. echo "<?php mysqli_report(0); print 'OK';" > /your/web/root/test.php

What does phpinfo() say? Is that listing mysqli?

@JasonWoof
Copy link
Contributor Author

I just remembered that php81 is now available, so I tested with that and was unable to reproduce this bug with php81 instead of php80 as shown in my configuration.nix sample above.

So, apologies for pinging apache maintainers. I'll attempt to ping a couple php folks:

@drupol @jtojnar

Sorry I don't understand how to find the maintainers, so that's just a couple people with recent commits.

@JasonWoof
Copy link
Contributor Author

When this bug happens, there is no longer a "mysqli" section (nor "mysqlnd") in the output of phpinfo().

@drupol
Copy link
Contributor

drupol commented May 31, 2022

Hi,

Have you tried to use PHP NTS instead of ZTS ?

(php.override {apxs2support=false; ztsSupport=false;})buildEnv(...)

Maybe it is a bug in PHP8 that has been fixed in 8.1 ?

https://php.watch/versions/8.1

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

No branches or pull requests

3 participants