Unusual "mysqli_connect function does not exist" error

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
User avatar
Mulsiphix
Registered User
Posts: 205
Joined: Sun Oct 25, 2015 3:14 am
Location: USA

Unusual "mysqli_connect function does not exist" error

Post by Mulsiphix »

After updating I encountered the following error:
General Error
SQL ERROR [ mysqli ]

mysqli_connect function does not exist, is mysqli extension installed? []

An sql error occurred while fetching this page. Please contact an administrator if this problem persists.
I have seen this before and had already fixed it when my board was v3.2.8. I had previously edited my config.php file accordingly, as seen here:

Code: Select all

<?php
// phpBB 3.2.x auto-generated configuration file
// Do not change anything in this file!
$dbms = 'phpbb\\db\\driver\\mysqli';
I also completely cleared my cache folder after updating my board, purged the cash, and purged all sessions. For fun I cleared my browser data. But the error remains. I am using PHP v7.3. Any ideas on what I am missing?
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28935
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier

Re: Unusual "mysqli_connect function does not exist" error

Post by Paul »

That means the mysqli extension is not enabled in your php installation. If you are using shared hosting you should contact your host, if you are using a VPS, you can try to enable the mysqli extension yourself.
User avatar
DoYouSpeakWak
Registered User
Posts: 2311
Joined: Fri Jul 25, 2008 1:32 pm
Location: Island of Wak-Wak

Re: Unusual "mysqli_connect function does not exist" error

Post by DoYouSpeakWak »

This error was also generated a few times for me, due to unsupported php version, even if the mysql extension was perfectly installed. Just Fyi
Whatever you share comes back. Support the phpBB Communities
Offering paid services. 15+ years of experience with phpBB3 and server management.
User avatar
warmweer
Jr. Extension Validator
Posts: 11854
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: Unusual "mysqli_connect function does not exist" error

Post by warmweer »

DoYouSpeakWak wrote: Tue Jan 07, 2020 7:25 pm This error was also generated a few times for me, due to unsupported php version, even if the mysql extension was perfectly installed. Just Fyi
If that is not a typo, then the error message is correct. ;)
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
</Solidjeuh>
Registered User
Posts: 1788
Joined: Tue Mar 29, 2016 3:45 am
Location: Aalst (Belgium)
Name: Andy Dm

Re: Unusual "mysqli_connect function does not exist" error

Post by </Solidjeuh> »

I had almost the same error a few months ago. I had to re-install mysqli via SSH

yum install php-mysqli (This is the command for centos7)
User avatar
Mulsiphix
Registered User
Posts: 205
Joined: Sun Oct 25, 2015 3:14 am
Location: USA

Re: Unusual "mysqli_connect function does not exist" error

Post by Mulsiphix »

Paul wrote: Tue Jan 07, 2020 7:03 pm That means the mysqli extension is not enabled in your php installation. If you are using shared hosting you should contact your host, if you are using a VPS, you can try to enable the mysqli extension yourself.
I am using shared hosting. However, I've used mysqli with v3.2.8 for over two months with no problems. Could this still be an issue?


</Solidjeuh> wrote: Tue Jan 07, 2020 8:35 pm I had almost the same error a few months ago. I had to re-install mysqli via SSH

yum install php-mysqli (This is the command for centos7)
I wanted to check the version of Linux my webhost was using. Via SSH I typed cat /proc/version and it returned:


Linux version 3.10.0-693.17.1.2.ELK.el6.x86_64 ([email protected]) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC) ) #1 SMP Thu Feb 8 23:35:45 MST 2018
I did a quick search and it looks like RedHat uses yum as well. When I typed the command you suggested it returned this error:


CRITICAL:yum.cli:Config Error: Error accessing file for config file:///etc/yum.conf
But being a shared host, maybe it says this because I don't have permissions to access that part of the system. If you have any other suggestions on this approach, I'd love to hear them.


DoYouSpeakWak wrote: Tue Jan 07, 2020 7:25 pm This error was also generated a few times for me, due to unsupported php version, even if the mysql extension was perfectly installed.
I can guarantee that PHP v7.1 is installed on my webhost by using the command ls /usr/local/bin, which returns:

Code: Select all

./                   ea_current_to_profile*         php-config@
../                  ea_install_profile*            phpize@
cdcc*                ea_sync_user_phpini_settings*  python2.7@
crc32*               htmltree*                      python_enable_2.7*
dccif-test*          json_pp*                       python_enable_3.5*
dccproc*             lsphp*                         ruby_enable_2.4*
ea-php55@            mech-dump*                     runonce*
ea-php56@            pear@                          test-yaml*
ea-php70@            peardev@                       tpage*
ea-php71@            pecl@                          tt-render*
ea-php72@            perl@                          ttree*
ea-php73@            php*                           use-devel-checklib*
ea_convert_php_ini*  php-cgi@                       wp*
"ea-php71" is PHP v7.1. I can confirm this by manually specifying which PHP version to use in my .htaccess file, and the below code works to switch between what is offered here. I know it works because phpBB reports the PHP version change in the ACP when I change it in the .htaccess file.

Currently the default PHP version of my webhost is 7.1, as is the .htaccess entry. Once I figure out what the problem is here, I will use .htaccess to utilize PHP v7.3 instead.

Code: Select all

# Set the “ea-php71” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>
User avatar
AlfredoRamos
Recognised Extension Developer
Posts: 1304
Joined: Wed Dec 25, 2013 9:06 pm
Location: /dev/null
Name: Alfredo

Re: Unusual "mysqli_connect function does not exist" error

Post by AlfredoRamos »

Mulsiphix wrote: Wed Jan 08, 2020 12:11 am I am using shared hosting. However, I've used mysqli with v3.2.8 for over two months with no problems. Could this still be an issue?
So you changed your PHP version though cPanel or Plesk?

If so, you need to enable the mysqli extension though the PHP options in cPanel or Plesk.

Each PHP version has it's own configuration file, so it doesn't matter if it was working with another PHP version, you must update the configuration of the one you're using.

You can check if it's actually enabled by showing all enabled extensions though the command line:

Code: Select all

php -m
Or

Code: Select all

php -m | grep mysql
You can replace php with the real executable file, for example:

Code: Select all

ea-php73 -m | grep mysql
The mysqli extension must show up, in my case:

Code: Select all

$ php -m | grep mysql
mysqli
mysqlnd
pdo_mysql
Some of my phpBB extensions:
:chart_with_upwards_trend: SEO Metadata | Image Markdown | :shield: hCaptcha
:trophy: Check out all my validated extensions :trophy:

:penguin: Arch Linux user | Linux Boards :penguin:
User avatar
Mulsiphix
Registered User
Posts: 205
Joined: Sun Oct 25, 2015 3:14 am
Location: USA

Re: Unusual "mysqli_connect function does not exist" error

Post by Mulsiphix »

AbaddonOrmuz wrote: Wed Jan 08, 2020 12:28 am So you changed your PHP version though cPanel or Plesk?
I went ahead and removed the cPanel changes (which are added to the .htaccess file). I first set them in cPanel and I then restored the .htaccess file that existed prior to making those changes.

I checked my backups directly before the update and there was no php.ini file present. After interacting with cPanel's PHP Selector, there was a php.ini file present in the root of my domain. So I deleted it.

If I understand this correctly, it now is as if these modifications never happened. Unfortunately none of these steps affected the error being generated by my forum.


AbaddonOrmuz wrote: Wed Jan 08, 2020 12:28 am If so, you need to enable the mysqli extension though the PHP options in cPanel or Plesk.
The only options I see is the ability to setup custom php.ini. When I click on that I see several options with "mysql" in the title, but none with "mysqli". Nor any that clearly state that it is used to enable or disable an extension. I did look inside the php.ini that cPanel had generated, and I found the MySQLI section shown below. If relevant, here is the entire file.

Code: Select all

[MySQLi]

; Maximum number of persistent links.  -1 means no limit.
; http://php.net/mysqli.max-persistent
mysqli.max_persistent = -1

; Allow accessing, from PHP's perspective, local files with LOAD DATA statements
; http://php.net/mysqli.allow_local_infile
;mysqli.allow_local_infile = On

; Allow or prevent persistent links.
; http://php.net/mysqli.allow-persistent
mysqli.allow_persistent = Off

; Maximum number of links.  -1 means no limit.
; http://php.net/mysqli.max-links
mysqli.max_links = -1

; If mysqlnd is used: Number of cache slots for the internal result set cache
; http://php.net/mysqli.cache_size
mysqli.cache_size = 2000

; Default port number for mysqli_connect().  If unset, mysqli_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
; http://php.net/mysqli.default-port
mysqli.default_port = 3306

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
; http://php.net/mysqli.default-socket
mysqli.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysqli.default-host
mysqli.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysqli.default-user
mysqli.default_user =

; Default password for mysqli_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
; http://php.net/mysqli.default-pw
mysqli.default_pw =

; Allow or prevent reconnect
mysqli.reconnect = Off

AbaddonOrmuz wrote: Wed Jan 08, 2020 12:28 am Each PHP version has it's own configuration file, so it doesn't matter if it was working with another PHP version, you must update the configuration of the one you're using.
Well that is good to know. I've been using PHP v7.2 with phpBB v3.2.8 for three months, and am still using it now, since that is what I know has worked with mysqli. I've tried using PHP versions v7.1, v7.2, and v7.3 tonight, but the website still responds the same.
Last edited by Mulsiphix on Wed Jan 08, 2020 1:15 pm, edited 5 times in total.
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28935
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier

Re: Unusual "mysqli_connect function does not exist" error

Post by Paul »

As you are on shared hosting you should contact their support as they can only fix it.
User avatar
Mulsiphix
Registered User
Posts: 205
Joined: Sun Oct 25, 2015 3:14 am
Location: USA

Re: Unusual "mysqli_connect function does not exist" error

Post by Mulsiphix »

Paul wrote: Wed Jan 08, 2020 7:28 am As you are on shared hosting you should contact their support as they can only fix it.
I am sorry, I do not understand what you are referring to. What, specifically, can only support fix? :oops:. I"m not sure what to ask them for help with. If it is system side, they will help. But if I ask them to troubleshoot my software specific problem directly, they will refuse.


AbaddonOrmuz wrote: Wed Jan 08, 2020 12:28 am You can check if it's actually enabled by showing all enabled extensions though the command line:

Code: Select all

php -m
Yes it is listed. Here is the full list:

Code: Select all

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imap
intl
ionCube Loader
json
libxml
mbstring
mcrypt
mysqli
odbc
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
pspell
Reflection
session
SimpleXML
soap
sockets
SourceGuardian
SPL
sqlite3
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib

AbaddonOrmuz wrote: Wed Jan 08, 2020 12:28 am

Code: Select all

php -m | grep mysql
This command returned:

Code: Select all

mysqli
pdo_mysql

AbaddonOrmuz wrote: Wed Jan 08, 2020 12:28 am You can replace php with the real executable file, for example:

Code: Select all

ea-php73 -m | grep mysql
Alright, I will do this for version 7.1, 7.2, and 7.3.
  1. ea-php71 -m | grep mysql
  2. ea-php72 -m | grep mysql
  3. ea-php73 -m | grep mysql
All three commands returned:

Code: Select all

mysqli
mysqlnd
pdo_mysql
Last edited by Mulsiphix on Wed Jan 08, 2020 12:58 pm, edited 1 time in total.
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28935
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier

Re: Unusual "mysqli_connect function does not exist" error

Post by Paul »

The error you get is because php is incorrect configured. So tell them the error and that they need to enable mysqli.
User avatar
Mulsiphix
Registered User
Posts: 205
Joined: Sun Oct 25, 2015 3:14 am
Location: USA

Re: Unusual "mysqli_connect function does not exist" error

Post by Mulsiphix »

Paul wrote: Wed Jan 08, 2020 12:46 pm The error you get is because php is incorrect configured. So tell them the error and that they need to enable mysqli.
I am now contacting support to see what they can do or have to say.


Question
Is it possible something weird happened during the update process that led to this situation? If support isn't able to identify an issue with MySQLi, would it be worth trying to restore my v3.2.8 backup (files and database) and then attempt to update to 3.3 again?
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28935
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier

Re: Unusual "mysqli_connect function does not exist" error

Post by Paul »

No, phpBB can't change the php configuration.
User avatar
Mulsiphix
Registered User
Posts: 205
Joined: Sun Oct 25, 2015 3:14 am
Location: USA

Re: Unusual "mysqli_connect function does not exist" error

Post by Mulsiphix »

You were right Paul. I contacted support and they responded with this:
Thanks for waiting, Marques. I did noticed that PHP version of subdomain is on 7.2. I did change it to 7.1 and I got the forum working this time. Looks like its not compatible to 7.2. Normally, mysql connection works on stable PHP version like 5.6 or 7.0 and 7.1 and phpBB 3.3 requires 7 plus. 7.2 and 7.3 are not yet stable as some plugins wont be compatible for its as of now ,
They are claiming that phpBB must not support v7.2. I understand it should support up to v7.4, but when they changed it back to v7.1.14, the site is accessible again. I guess I will have to wait for v7.2 to v7.4 until a later date. This issue is now Solved.


@Everyone: Thank you for your support, feedback, and patience. I truly appreciate it ;)
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28935
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier

Re: Unusual "mysqli_connect function does not exist" error

Post by Paul »

It should work on php 7.2.
Can you place put your php on 7.2, create a file named info.php and put the following in there:

Code: Select all

<?php phpinfo(); ?>
And PM me the link to that file?

Return to “[3.3.x] Support Forum”