" Uncaught Error: Call to undefined function mysqli_connect()"

screenshot of error

I'm using mysql Server version: 5.7.24-0ubuntu0.18.04.1 (Ubuntu), trying to do a simple connection to the database but whenever I try to connect to the database, I get this error.

 127.0.0.1:34236 [500]: /process.php - Uncaught Error: Call to undefined function mysqli_connect() in /home/kipo/Desktop/php-crud/process.php:3 Stack trace: #0 {main} thrown in /home/kipo/Desktop/php-crud/process.php on line 3

please help me out. Thanks

1 Answer

You'd be needing to install the php-mysql package using apt.

sudo apt-get install php-mysql

From there, restart apache2

sudo service restart apache2

For a distro on systemd [If service is not a defined command], you can use:

sudo systemctl restart apache2

Your script should be working after that

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like