Home >Backend Development >PHP Tutorial >How to Fix 'Fatal Error: Call to Undefined Function mysqli_connect()'?
You're encountering the "Fatal error: Call to undefined function mysqli_connect()" error when trying to access a database on a new server. Despite copying the relevant PHP and SQL files from a previous site where the code functioned correctly, you're facing this issue on the new server.
This error typically occurs when the MySQLi PHP extension is not installed or enabled on the new server. To resolve the problem:
Run the following command on the new server: $ sudo apt install php-mysqli
This will install the necessary MySQLi PHP extension, enabling your application to access the MySQL database.
It's important to note that you may need to restart your web server after installing the extension for the changes to take effect.
The above is the detailed content of How to Fix 'Fatal Error: Call to Undefined Function mysqli_connect()'?. For more information, please follow other related articles on the PHP Chinese website!