Fatal error: Uncaught Error: Call to undefined function mysqli_connect()

Abhishek Parmar

Error

Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /var/www/html/login.php:8 Stack trace: #0 {main} thrown in /var/www/html/login.php on line 8

Code

<?php
$servername = "172.17.0.2:3306";
$username = "mysql_user";
$password = "mysql_password";
$dbname = "invoice";

// Create connection
$conn = mysqli_connect($servername, $username, $password,$dbname);
?>

I am running it from php:7.0-apache docker container and I have already installed mysqli extension using following command:

docker-php-ext-install mysqli 
docker-php-ext-enable mysqli
apachectl restart

What did I miss?

jaymin patel

Check the path to php extension_dir correct or not. if it's not correct or there is not a path, then add absolute path of mysqli.so in php.ini ,

In my case, mysqli.so was at /usr/local/lib/php/extensions/no-debug-non-zts-20151012

You have to add ,

extension = /usr/local/lib/php/extensions/no-debug-non-zts-20151012/mysqli.so 

in your php.ini.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Uncaught Error: Call to undefined function mysqli_connect() | docker-compose

Fatal error: Uncaught Error: Call to undefined function mysql_connect()

Fatal error: Call to undefined function oci_connect() in Wamp

Fatal error: Uncaught Error: Call to undefined function ereg_replace() PHP 7

Fatal error: Uncaught Error: Call to undefined function mb_detect_encoding()

Fatal error: Uncaught Error: Call to undefined function - have to use $this

In PHP 7.0 Fatal error: Uncaught Error: Call to undefined function json_encode()

Fatal error: Uncaught Error: Call to undefined function bcadd()

Fatal error: Uncaught Error: Call to undefined function wp_get_current_user()

Fatal error: Uncaught Error: Call to undefined function get_option()

PHP 7.4.1 Uncaught Error: Call to undefined function mysqli_connect()

Fatal error: Uncaught Error: Call to undefined function mysqli_connect() on Windows 10

Fatal error: Uncaught Error: Call to undefined function curl_version() - Localhost Dev

Fatal error: Call to undefined function odbc_connect()

Fatal error: Call to undefined function sqlsrv_connect()

PHP to Postgres - Fatal error: Call to undefined function pg_connect()

Fatal error: Call to undefined function

PHP Fatal error : Call to undefined function mysql_connect()

Uncaught Error: Call to undefined function

Fatal error: Uncaught Error: Call to a member function

PHP Fatal error: Uncaught Error: Call to undefined function mssqli_fetch_assoc()

Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::get_result()

Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetch_assoc()

Fatal error: Uncaught Error: Call to undefined function mysql_close()

Fatal error: Uncaught Error: Call to undefined function redirect() PHP logout session

Fatal error: Uncaught Error: Call to undefined method why?

Fatal error: Uncaught Error: Call to undefined method mysqli_result::mysqli_fetch_array() in

Fatal error: Uncaught Error: Call to undefined function header() - Beginner question

Fatal error: Uncaught Error: Call to undefined function get_header()