Announcement

#1 2020-01-04 19:47:43

krist
Member
2016-01-30
53

[solved] piwigo not working after updating debian 9 to 10

Hello/Hi/Greetings,

After updating Debian 9 to 10, I have this error

Fatal error: Uncaught Error: Class 'mysqli' not found in /var/www/html/piwigo.com/include/dblayer/functions_mysqli.inc.php:67 Stack trace: #0 /var/www/html/piwigo.com/include/common.inc.php(124): pwg_db_connect('localhost', 'root', 'esidara', 'piwigo') #1 /var/www/html/piwigo.com/index.php(26): include_once('/var/www/html/p...') #2 {main} thrown in /var/www/html/piwigo.com/include/dblayer/functions_mysqli.inc.php on line 67

I checked an I do have php7.3-mysql installed This package include a virtual mysqli.  But calling it on line 67 does not work. 
Although I am on piwigo 2.9.4, I tried to update it to 2.10.1 before upgrade Debian 9 to 10, but got the same error. 

BTW, this is on my own server with the name piwigo.com

Any help is appreicated.

Piwigo version: 2.9.4
PHP version: 7.3
MySQL version: mysql-common 5.8+1.0.5
Piwigo URL: http://

Last edited by krist (2020-01-10 17:07:41)

Offline

 

#2 2020-01-04 23:13:34

erAck
Only trying to help
2015-09-06
1998

Re: [solved] piwigo not working after updating debian 9 to 10

Make sure mysqli is actually loaded as PHP module.
First hit in search of https://www.qwant.com/?q=%22Fatal%20err … &t=web
See https://unix.stackexchange.com/a/525904 Check 3.


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2020-01-05 17:49:42

krist
Member
2016-01-30
53

Re: [solved] piwigo not working after updating debian 9 to 10

Thanks erAck for your reply.  I followed the 3 checks and it seems everything is ok, and here are the results:

Check 1
dpkg --list | grep 'php.*mysql'
ii  php-mysql                             2:7.3+69                             all          MySQL module for PHP [default]
rc  php7.0-mysql                          7.0.33-0+deb9u6                      amd64        MySQL module for PHP
ii  php7.3-mysql                          7.3.11-1~deb10u1                     amd64        MySQL module for PHP

Check 2
find /usr/lib/php -name mysqli.so
/usr/lib/php/20180731/mysqli.so

Check 3
grep mysqli.so /etc/php/7.3/*/conf.d/*
/etc/php/7.3/apache2/conf.d/20-mysqli.ini:extension=mysqli.so
/etc/php/7.3/cli/conf.d/20-mysqli.ini:extension=mysqli.so

Here is line 67 where the error occurs
$mysqli = new mysqli($host, $user, $password, $dbname, $port, $socket);
  if (mysqli_connect_error())
  {
    throw new Exception("Can't connect to server");
  }
  if (!$mysqli->select_db($database))
  {
    throw new Exception('Connection to server succeed, but it was impossible to connect to database');

Any other suggestions please.

Last edited by krist (2020-01-05 18:51:45)

Offline

 

#4 2020-01-06 08:03:49

nicolas
Former Piwigo Team
2004-12-30
1232

Re: [solved] piwigo not working after updating debian 9 to 10

Do you restart apache ?

Code:

$ apache2clt restart

Do you see mysqli extension in a php info page ?
Just in case, a php info page is a simple script (accessible through your web server) with the following content :

Code:

<?php
phpinfo();

Offline

 

#5 2020-01-06 17:43:31

krist
Member
2016-01-30
53

Re: [solved] piwigo not working after updating debian 9 to 10

Yes, I did restart apache2.

sudo /etc/init.d/apache2 restart
[ ok ] Restarting apache2 (via systemctl): apache2.service.


Phpinfo() show mysqli

mysqli

MysqlI Support => enabled
Client API library version => mysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $
Active Persistent Links => 0
Inactive Persistent Links => 0
Active Links => 0


BTW, how do I use Code block (I cannot find a button for it).

Thanks.

Last edited by krist (2020-01-06 17:46:53)

Offline

 

#6 2020-01-06 17:53:53

nicolas
Former Piwigo Team
2004-12-30
1232

Re: [solved] piwigo not working after updating debian 9 to 10

Ok so no problem with your webserver. But unfortunaltly I have no more idea.

Are you sure you use the same configuration for the page phpinfo and piwigo ? On my debian I switched to php-fpm and no more use libapache2-mod-php. Of course the php configuration for php-fpm is not the same as the apache ones.

There's no button as far as I know. I add the button by hand with [ code] and[ /code] (without space after the bracket)

Offline

 

#7 2020-01-06 22:04:35

krist
Member
2016-01-30
53

Re: [solved] piwigo not working after updating debian 9 to 10

nicolas wrote:

Are you sure you use the same configuration for the page phpinfo and piwigo ?

I just used
php -i

and searched for mysqli.  I do not know where to look for phpinfo() under piwigo.

Are you using Debian 9 or 10?
I might have to go back to debian 9 if I cannot get this resolved.

Last edited by krist (2020-01-06 22:06:50)

Offline

 

#8 2020-01-07 04:02:32

Zentalquabula
Member
2014-05-10
217

Re: [solved] piwigo not working after updating debian 9 to 10

Connection to server succeed, but it was impossible to connect to database.

That means the problem is with MySQL. Check your databases for existence and corruption. Did the migration work as planned when you upgraded OS?

Offline

 

#9 2020-01-07 04:08:17

erAck
Only trying to help
2015-09-06
1998

Re: [solved] piwigo not working after updating debian 9 to 10

Btw, it's time to change the database password, and choose a better one as well..


Running Piwigo at https://erack.net/gallery/

Offline

 

#10 2020-01-07 21:07:31

krist
Member
2016-01-30
53

Re: [solved] piwigo not working after updating debian 9 to 10

Zentalquabula wrote:

Connection to server succeed, but it was impossible to connect to database.

That means the problem is with MySQL. Check your databases for existence and corruption. Did the migration work as planned when you upgraded OS?

There were no problems during upgrade from debian 9 to 10.  I loaded a backup database dump and the error is still there.  I'll do another upgrade, but instead of the stable 10, I'll do the debian 10 testing and see if it helps.

Offline

 

#11 2020-01-07 21:52:03

nicolas
Former Piwigo Team
2004-12-30
1232

Re: [solved] piwigo not working after updating debian 9 to 10

It looks very strange. I do not understand.
Try a simple script in the same directory as the phpinfo script to be sure to use the same php environment and try a connection to teh database pointing to database.inc.php file from piwigo.

A script like the following ones :

Code:

<?php
include_once('/var/projets/git/Piwigo/local/config/database.inc.php');

$mysqli = new mysqli($conf['db_host'], $conf['db_user'], $conf['db_password'], $conf['db_base']);
if (mysqli_connect_error()) {
    throw new Exception("Can't connect to server");
} else {
    echo "<p>Successfully connect to mysql server</p>";
}

if (!$mysqli->select_db($conf['db_base'])) {
    throw new Exception('Connection to server succeed, but it was impossible to connect to database');
} else {
    echo "<p>Successfully connect to database</p>";
}

Of course change the path (it can be absolute) to database.inc.php

To answer your previous question, I'm on debian unstable, so the future debian 11 ! :-)

Offline

 

#12 2020-01-08 20:24:42

Zentalquabula
Member
2014-05-10
217

Re: [solved] piwigo not working after updating debian 9 to 10

Login to mysql and check users, databases and tables. Use terminal or a GUI app like Sequel Pro or MySQLWorkbench.

krist wrote:

Zentalquabula wrote:

Connection to server succeed, but it was impossible to connect to database.

That means the problem is with MySQL. Check your databases for existence and corruption. Did the migration work as planned when you upgraded OS?

There were no problems during upgrade from debian 9 to 10.  I loaded a backup database dump and the error is still there.  I'll do another upgrade, but instead of the stable 10, I'll do the debian 10 testing and see if it helps.

Offline

 

#13 2020-01-08 20:38:58

nicolas
Former Piwigo Team
2004-12-30
1232

Re: [solved] piwigo not working after updating debian 9 to 10

Zentalquabula wrote:

Login to mysql and check users, databases and tables. Use terminal or a GUI app like Sequel Pro or MySQLWorkbench.

How can that helps ?

You supposed that this is a credential connection problem (or something like that) but the first message saids mysqli class does not exist.

Offline

 

#14 2020-01-09 17:32:17

krist
Member
2016-01-30
53

Re: [solved] piwigo not working after updating debian 9 to 10

Thanks guys for all the suggestions.  I stumbled upon the solution from google on missing mysqli.

Here is what I did

sudo apt purge php7.0-*
sudo apt purge php7.3-* phpmyadmin
After removed, reinstall packages:

sudo apt install apache2 php7.3 php7.3-mysql

My piwigo works now.  So, there must have been an upgrade error corrupting php (although I did not notice any error message)

But I am now missing phpmyadmin which does not come with debian 10.  I can download and install it, but do I need it for piwigo?  I remember I did use it when I transitioned from Gallery3 to piwigo to locate some files and databases.

Thanks for all the help.

Last edited by krist (2020-01-09 17:49:23)

Offline

 

#15 2020-01-09 22:26:46

erAck
Only trying to help
2015-09-06
1998

Re: [solved] piwigo not working after updating debian 9 to 10

Great you could fix it.

phpMyAdmin is not needed, but it can come handy if you want to inspect the database or adjust things. An alternative is Adminer (see https://www.adminer.org/) for which Debian has a package. It's said to focus more on security and performance than phpMyAdmin.


Running Piwigo at https://erack.net/gallery/

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact