#1 2020-11-28 19:08:55

carrabta
Member
2020-11-28
5

PHP extension "mysqli" is not loaded | FREENAS

Hi all,
I'm posting here as I've had no luck on Stackoverflow.
I have installed Apache24, MariaDB and PHP 7.2.34 on a jail on FREENAS 11.2. As far as I can tell this stack is working well: I can access my website and display in a browser the phpinfo().
I have downloaded Piwigo 2.10.2 and unzipped it.
When accessing the index.php, it rediects to install.php and display the error:
Piwigo encountered a non recoverable error
PHP extension "mysqli" is not loaded

Yet, when displaying the phpinfo(), I can see mysqli properly loaded.

All issues reported for this problem that I found on internet were caused by the fact that mysqli was genuinely NOT loaded. In my case it IS loaded. So I'm now suspecting a bug in the Piwigo install script for my config, in which, for some reason, it would not properly identify the modules loaded. Would that be possible ?

Any assistance would be greatly appreciated - Thanks !

Tanguy

Offline

 

#2 2020-11-29 00:49:46

erAck
Only trying to help
2015-09-06
2177

Re: PHP extension "mysqli" is not loaded | FREENAS

Assuming that question
https://stackoverflow.com/questions/649 … not-loaded
is your question I noticed that you queried php info as root. Does calling php info as the web server user produce the same values?

Does this
php -r 'print_r(get_loaded_extensions());' | grep mysqli
produce an output?

If so, check from within a .php file interpreted by the webserver:

Code:

<?php
print_r(get_loaded_extensions());
?>

Does it list mysqli?

If not, make sure you don't use two different php versions on command line and in webserver and install the proper mysqli package for both.

If yes, next step would be to see if you can create a PHP mysqli instance similar to function pwg_db_connect() in include/dblayer/functions_mysqli.inc.php, like

  $mysqli = new mysqli($host, $user, $password, $dbname, $port, $socket);

Set variables with proper PHP strings and existing database to test, set $port and $socket to null if unused.

If that doesn't work you have some setup problem.


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

Online

 

#3 2020-11-29 13:35:52

carrabta
Member
2020-11-28
5

Re: PHP extension "mysqli" is not loaded | FREENAS

Many Thanks for the reply, it seems you've spotted in the right direction.
(Also well spotted with the post on Stackoverflow, it is indeed mine!)

So, in a shell as root,
   > php -r 'print_r(get_loaded_extensions());' | grep mysql
Produces:
   > PHP Warning:  Module 'mysqli' already loaded in Unknown on line 0
   > [21] => mysqli

Whilst the same instruction interpreted via the browser does not show any 'Mysqli'.

That springs mutliple questions, then:
1) the warning in the output of the instruction in the shell does seem to indicate mutliple instances trying to load that module, correct ?
  However, I've looked for other 'php.ini' in the entire system (jail), but there's none. Where else could the instruction come from ?

2) In the php file to be interpreted by the browser (so with 'www' user), I've left the 'phpinfo()' and added the 'get_loaded_extensions()' instruction to be shown underneath. From 'phpinfo()', I can see:
   In table "Module Authors", module "Mysqli" and its authors.
I had assumed that this meant the module was loaded. Yet, the 'get_loaded_extensions()' on that same page does not list 'mysqli' (it does list 40 other modules).So what does the fact that Mysqli is shown in phpinfo() actually tells us ? That it is simply installed but not necessarily loaded ?

In 'php.ini', if I uncomment the line 'extension mysqli', I get the output above. If I leave it commented, I don't get the warning anymore, yet still the same output when exectuted as root in shell ([27] => mysqli).
The php webpage with the phpinfo() and get_loaded_extensions() instructions display the same things (and yes I had restarted Apache after making the change in php.ini).

So it does seem that there is an issue in the config if read by root Vs by 'www', and php.ini seems to not be the leading config file for PHP as the Mysqli module appears loaded (for root) regardless of having the corresponding line commented or not in php.ini.
I fear I would need another assistance to make a step further.

Thanks in advance !
Tanguy

Offline

 

#4 2020-11-29 14:37:51

erAck
Only trying to help
2015-09-06
2177

Re: PHP extension "mysqli" is not loaded | FREENAS

Webserver uses a different php.ini than CLI, phpinfo() for CLI shows something like

Loaded Configuration File => /etc/php/7.3/cli/php.ini
Scan this dir for additional .ini files => /etc/php/7.3/cli/conf.d
Additional .ini files parsed => [...list...]

Whereas for webserver (phpinfo() interpreted in .php file) it may be

Loaded Configuration File => /etc/php.ini
Scan this dir for additional .ini files => /etc/php/7.3/apache2/conf.d
Additional .ini files parsed => [...list...]

Check the differences.


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

Online

 

#5 2020-12-07 23:57:32

carrabta
Member
2020-11-28
5

Re: PHP extension "mysqli" is not loaded | FREENAS

Thanks again, but no luck.
I've searched for any other php.ini in the whole system, there is just one.

I've just looked in /var/log/httpd-error.log and can see:
AH01071: Got error 'PHP message: PHP Fatal error:  PHP extension "mysqli" is not loaded\n in /usr/local/www/apache24/data/photo/piwigo/include/functions_html.inc.php on line 388\n'

I think I'll have to bin the jail and start all over again, to see what happens....

Tanguy

Offline

 

#6 2021-01-13 19:36:11

carrabta
Member
2020-11-28
5

Re: PHP extension "mysqli" is not loaded | FREENAS

Note to close this thread:
I solved this issue (unexpectedly) by updating FreeNAS (minor update).

Thanks for your time and ideas !
Tang'

Offline

 

Board footer

Powered by FluxBB

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