0

i was updating my production server with php 8 and i discovered an error "Fatal Error: Class mysqli not found". So i asked to the support and they told me that "according to php official manual, mysqli is not supported anymore in php 8".

I tried to find any news on the internet about this, but i can't find anything.

Looking at the php changelog, they talk about bugfixes for mysqli library until PHP 8.0.2, then nothing. Looking at the MySQLi official page on the php manual, there is only "PHP5, PHP7" as supported (while there is PHP 8 on PDO instead).

So, has somebody any news about this? What happened?

I got the same problem installing Wamp Server on a local machine with PHP 8.0.6, so i think they really removed MySQLi from the library, but in both local and production doing a phpinfo() i can clearly see "mysqli" extension installed.

Thank you in advance.

EDIT: About the production server, basically, provider told me "use sp-php instead of php", and now mysqli works. About the PHP.net, i think they forgot to add the support.

StefanoV827
  • 269
  • 6
  • 18

2 Answers2

1

It's just a documentation problem. There's a pull request to add PHP/8 to the supported versions but it hasn't made its way to live yet.

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
  • It's a January pull request and we still have this problem. I also tried in localhost installing wamp server and I got the same error for mysqli. I wonder if they are about to removing mysqli from php... – StefanoV827 Jul 06 '21 at 13:31
  • This answers the "Is it true that mysqli is not supported any more as of PHP/8" part. How to make it work in your two different environments is really a different subject and we don't have any information about the setup or the exact problems. A removal would have been discussed in a public RFC document and would have never happened suddenly and without prior notice. – Álvaro González Jul 06 '21 at 13:36
  • I notice that this happen to me only launching PHP with CLI. If i use MySQLi by browser it works perfectly, but if i run the script by CLI, i get that error! – StefanoV827 Jul 06 '21 at 14:18
  • I have another detail: If i launch the command by SSH access, i get no error. But if i launch the php command with the "exec" function, then i got the error. Sounds like a privilege error at this point. So as you said just a documentation problem maybe. – StefanoV827 Jul 06 '21 at 14:26
0

Mysqli is still supported with PHP ≥8.

In my Ubuntu (22.04) for example, it was not included in the distribution. You can install it at any time with:

sudo apt-get install php-mysqlnd

After rebooting PHP, everything works as expected.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Gary Czychi
  • 204
  • 1
  • 3
  • 10