I am getting below error when trying to access from browser "http://192.168.x.x:9091/testcon.php"
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /var/www/html/testcon.php
Contents of testcon.php is like below,
<?php
$servername = "db";
$username = "root";
$password = "pass1234";
$dbname='server';
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
But the same is working from inside container. If i run like "php testcon.php" it will work
root@e951040c5265:/var/www/html# php testcon.php
Connected successfullyroot@e951040c5265:/var/www/html#
I have also edited /usr/local/etc/php/php.ini-development and uncommented line "extension=mysqli", Still facing same issue
docker images used are below,
mysql:8.0.1
php:7.4.7-apache
phpmyadmin/phpmyadmin
TIA