r/PHPhelp • • Feb 06 '25

Call to undefined function mysqli_connect()

0 Upvotes

I've been trying to fix this issue for days, I tried checking if all the configuration files in xampp are set up correctly, I tried uninstalling and reinstalling xampp, nothing seems to work.

I'm bound to using mysqli to connect to a database for my uni project, so I can't look for an alternative.

Does anyone have a solution for this?

r/PHPhelp • • Sep 14 '21

Solved Issue with mysqli_connect()

2 Upvotes

I keep getting this error when ever i load up my website on windows:

Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in dir\public\config.php:8 Stack trace: #0 {main} thrown in dir\public\config.php on line 8

Ive looked online and tried editing the php.ini (not running apache so dont mention it) with uncommenting the extention= php_mysqli and even extension_dir = "E:\php\ext" but this didnt fix it. Below is my config file:

Config.php:

<?php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', 'test');
define('DB_NAME', 'web_mc_login');
 
/* Attempt to connect to MySQL database */
$link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
 
// Check connection
if($link === false){
    die("ERROR: Could not connect to " . DB_NAME + "Reason: " . mysqli_connect_error());
}

EDIT: Mange to fit by reinstalling php. No clue why though that would fix it

r/Egypt_Developers • • 18h ago

Problem عايزة اعرف ايه المشكلةدلوقتي بليز في SQL اللي في database

Thumbnail
gallery
6 Upvotes

r/PHPhelp • • Mar 31 '20

Call to undefined function mysqli_connect()

2 Upvotes

Hello!

So I have my code:

<?php
/* Database credentials. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
define('DB_NAME', 'slashed');
 
/* Attempt to connect to MySQL database */
$link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);

$mysqli = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
 
// Check connection
if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
} else {
	// echo("Success");
}
?>

and it throws: Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /var/www/html/assets/config.php:10

I have done everything I could find, and am at my wit's end.

I am using an AWS ec2 with the amazon Linux distro.

Thanks!

r/PHPhelp • • Dec 05 '23

Solved PHP 5.6.40 MYSQL functions not working? - "Call to undefined function mysqli_connect()"

0 Upvotes

The DLL loads fine, but I still get Fatal error: Call to undefined function mysqli_connect() when testing it.

I have to use a version 5.x on this internal system for the moment - at some point the codebase it will be updated, to work with newer versions but don't have the time right now.

php -m shows it is the loaded

php -i shows

Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password
API Extensions => mysql,mysqli,pdo_mysql

mysqli
MysqlI Support => enabled
Client API library version => mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
Active Persistent Links => 0
Inactive Persistent Links => 0
Active Links => 0
Directive => Local Value => Master Value
mysqli.allow_local_infile => On => On
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => no value => no value
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
mysqli.rollback_on_cached_plink => Off => Off

Anything else I should be looking for?

r/PHPhelp • • Feb 01 '23

Can’t connect to mysqli

1 Upvotes

Php 7.4 - mysqlnd 7.4.3-4ubuntu2.17 Mysqli is installed, I uncommented “extension=mysqli” in php.ini

Whenever I try and do any MySQLi commands it says that it is not defined. What am I missing?

r/PHPhelp • • Dec 15 '22

mysqli_connect security

2 Upvotes

I am wondering if this function is vulnerable to timing attacks and whether or not I need to add additional code for added security or does mysqli_connect work in a way that would prevent a timing attack? I assume it does but was wondering if someone can verify if this is a safe way to authenticate someones credentials?

$connection = mysqli_connect($servername, $username, $password, $database_name);

if (mysqli_connect_errno()) {

echo "Failed to connect" . mysqli_connect_error(); }

else {

echo "connected";

mysqli_close($connection); }

?>