Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve "Fatal error: Class 'MySQLi' not found"?

Tags:

php

mysqli

I am doing a tutorial and am getting this error:

Fatal error: Class 'MySQLi' not found (LONG URL) on line 8

The code on line 8 is:

$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name); 

I saw online someone said to see if it was turned on in my phpinfo(), but there wasn't anything listed in there under for "mysqli".

Also, I am running PHP version 5.2.5

like image 863
Tylor Avatar asked Mar 20 '09 16:03

Tylor


People also ask

How do I know if mysqli is installed?

Check if MySQLi is Installed You can do that by visiting a phpinfo() page that you made, or by running this command: php -m | grep mysqli.

How configure mysqli in PHP?

It'll automatically enable the mysqli extension for the PHP because connect using mysql is deprecated in PHP 7. If not an Ubuntu user then you can just rename php-prodcution. ini file to php. ini and enable the extension by removing semicolon in the php.

How do I download mysqli?

Installing MySQL on Windows Simply download the installer package, unzip it anywhere, and run setup.exe. Default installer setup.exe will walk you through the trivial process and by default will install everything under C:\mysql.

Is mysqli deprecated in PHP 7?

The oldest one uses the MySQL extension, which was deprecated as of PHP 5.5 and fully removed in PHP 7. The mysql() function no longer works in PHP 7. It has been replaced with mysqli().


1 Answers

Sounds like you just need to install MySQLi.

If you think you've done that and still have a problem, please post your operating system and anything else that might help diagnose it further.

like image 55
Greg Avatar answered Oct 25 '22 11:10

Greg