Page MenuHomePhabricator

PHP does not find mysqli on tools-sgebastion-07
Closed, ResolvedPublic

Description

When starting a php file like

<?php
  $dbi = new mysqli('tools-db', "some user", "some password", 's51512__data') or die("database connection failed: " . $dbi->connect_error);
?>

I get an error

PHP Fatal error:  Uncaught Error: Class 'mysqli' not found in /mnt/nfs/labstore-secondary-tools-project/wikihistory/test/x.php:2
Stack trace:
#0 {main}
  thrown in /mnt/nfs/labstore-secondary-tools-project/wikihistory/test/x.php on line 2

As I have seen, php 7.0 is installed but there is no directory /usr/share/php7.0-mysql/ ; However there is some /usr/share/php7.2-mysql/ but no binary corresponding php7.2?

Event Timeline

Wurgl created this task.Feb 13 2019, 9:13 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 13 2019, 9:13 PM
bd808 added a comment.Feb 13 2019, 9:54 PM

We have package pinning/dependency issues that are keeping some things from being installed as expected:

$ sudo -i puppet agent -tv
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for tools-sgebastion-07.tools.eqiad.wmflabs
Notice: /Stage[main]/Base::Environment/Tidy[/var/tmp/core]: Tidying 0 files
Info: Applying configuration version '1550094412'
Error: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php7.2-cli' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.2-cli : Depends: libpcre3 (>= 2:8.41) but 2:8.39-3 is to be installed
E: Unable to correct problems, you have held broken packages.
Error: /Stage[main]/Profile::Toolforge::Grid::Exec_environ/Package[php7.2-cli]/ensure: change from absent to latest failed: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php7.2-cli' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.2-cli : Depends: libpcre3 (>= 2:8.41) but 2:8.39-3 is to be installed
E: Unable to correct problems, you have held broken packages.
Error: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php-xdebug' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php-xdebug : PreDepends: php-common (>= 2:69~) but 1:49 is to be installed
E: Unable to correct problems, you have held broken packages.
Error: /Stage[main]/Profile::Toolforge::Grid::Exec_environ/Package[php-xdebug]/ensure: change from 2.7.0~beta1+2.6.1+2.5.5-2+0~20181019070242.5+stretch~1.gbp70417f to 2.7.0~rc1+2.6.1+2.5.5-1+0~20190203094445.6+stretch~1.gbpf2664f failed: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php-xdebug' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php-xdebug : PreDepends: php-common (>= 2:69~) but 1:49 is to be installed
E: Unable to correct problems, you have held broken packages.
Error: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php7.2-zip' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.2-zip : Depends: libzip4 (>= 1.3.2) but 1.1.2-1.1+b1 is to be installed
E: Unable to correct problems, you have held broken packages.
Error: /Stage[main]/Profile::Toolforge::Grid::Exec_environ/Package[php7.2-zip]/ensure: change from absent to latest failed: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php7.2-zip' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.2-zip : Depends: libzip4 (>= 1.3.2) but 1.1.2-1.1+b1 is to be installed
E: Unable to correct problems, you have held broken packages.
Notice: Applied catalog in 59.41 seconds
Wurgl updated the task description. (Show Details)Feb 13 2019, 10:20 PM

For whatever reason, it looks like apt is not pulling in libzip and libpcre from thirdparty/php72. Note that Moritz *just* updated php72, so it'll actually want to pull in a totally different libpcre, and libzip5 I think.

Legoktm added a subscriber: bd808.

OK, I got the timing of events wrong. This should get fixed by Moritz's https://gerrit.wikimedia.org/r/c/operations/puppet/+/490579/ and then the next import.

I've imported pcre and libzip and that fixes the php72 component. There's still a Toolforge-specific issue, though: xdebug now depends on php-common, so it also needs to be imported to the thirdparty/php72 repo. Can someone from WMCS take this? Fix is similar to my patch from https://gerrit.wikimedia.org/r/c/operations/puppet/+/490579/, needs to also cover php-defaults.

Change 490623 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[operations/puppet@production] php72: sync php-defaults to component/php72

https://gerrit.wikimedia.org/r/490623

Change 490623 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] php72: sync php-defaults to component/php72

https://gerrit.wikimedia.org/r/490623

bd808 added a subscriber: aborrero.Feb 14 2019, 4:50 PM

After the repo contents fix from @MoritzMuehlenhoff in https://gerrit.wikimedia.org/r/c/operations/puppet/+/490579/, mysqli is fixed.

$ php -m | grep mysqli
mysqli

My attempt at fixing xdebug wasn't correct, but @aborrero has said he will follow up and find the correct reprepro recipe.

bd808 added a subscriber: MoritzMuehlenhoff.
MoritzMuehlenhoff closed this task as Resolved.Feb 14 2019, 5:15 PM

Should be fixed now? JFTR, the command to run afterwards is

reprepro --component thirdparty/php72 update stretch-wikimeida

Puppet should be fixed now in Toolforge, if not, please reopen.

bd808 reopened this task as Open.EditedFeb 14 2019, 5:25 PM

Should be fixed now? JFTR, the command to run afterwards is

reprepro --component thirdparty/php72 update stretch-wikimeida

Puppet should be fixed now in Toolforge, if not, please reopen.

Still failing to install the xdebug package for a missing php-common dependency. My patch to grab that from the upstream seems to be wrong. I thought adding php-defaults would pull in that whole module (probably not the right word) from upstream, but it only pulled in the php-defaults package itself.

$ sudo -i puppet agent -tv
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for tools-sgebastion-07.tools.eqiad.wmflabs
Notice: /Stage[main]/Base::Environment/Tidy[/var/tmp/core]: Tidying 0 files
Info: Applying configuration version '1550164726'
Error: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php-xdebug' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php-xdebug : PreDepends: php-common (>= 2:69~) but 1:49 is to be installed
E: Unable to correct problems, you have held broken packages.
Error: /Stage[main]/Profile::Toolforge::Grid::Exec_environ/Package[php-xdebug]/ensure: change from 2.7.0~beta1+2.6.1+2.5.5-2+0~20181019070242.5+stretch~1.gbp70417f to 2.7.0~rc1+2.6.1+2.5.5-1+0~20190203094445.6+stretch~1.gbpf2664f failed: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php-xdebug' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php-xdebug : PreDepends: php-common (>= 2:69~) but 1:49 is to be installed
E: Unable to correct problems, you have held broken packages.

Interesting:

Package: php-common
Source: php-defaults (69)
Version: 2:69
[...]

So php-common comes from src:php-defaults indeed, and our reprepro filter should allow it. I'm not finding the issue.

While other filters works, something weird happens with this one:

root@install1002:/srv/wikimedia/dists/stretch-wikimedia/thirdparty/php72/binary-amd64# grep "Source: xdebug"  Packages | wc -l
1
root@install1002:/srv/wikimedia/dists/stretch-wikimedia/thirdparty/php72/binary-amd64# grep "Source: php7.2"  Packages | wc -l
72
root@install1002:/srv/wikimedia/dists/stretch-wikimedia/thirdparty/php72/binary-amd64# grep "Source: php-defaults"  Packages | wc -l
0
MoritzMuehlenhoff closed this task as Resolved.Feb 15 2019, 9:32 AM
MoritzMuehlenhoff claimed this task.

I'm puzzled as why reprepro doesn't pick that up, passing --noskipold didn't help either. For reason the source package got imported, but none of the binary packages.

To unbreak Toolforge, I set up an nspawn container, added the sury.org apt source and key and downloaded the debs via "apt-get download", which I then imported using includedeb. Puppet runs on tools-sgebastion-07 are now working fine again.