lundi 22 février 2021

not able to build successful connection with XAMMP server in Mac

I am not able to connect to XAMPP server in Mac successfully. I am getting following error upon executing the PHP script in html php website.

Error

Warning: mysqli_connect(): (HY000/2002): No such file or directory in /Users/Jordan/.bitnami/stackman/machines/xampp/volumes/root/htdocs/ytwebsite/images/index.php on line 7

Connection to database is failed due to No such file or directory

PHP Script

<?php

$server = "localhost";
$username = "root";
$password = "";

$con = mysqli_connect($server,$username,$password);

if(!$con){

    die("Connection to database is failed due to ".mysqli_connect_error());
}

    echo "Successful Connection To The Database";
     


?>

as I am new to learning about php websites please guide me how can I resolve this issue.

I have placed the website folder inside the htdocs folder of the XAMPP server after mounting it.




Aucun commentaire:

Enregistrer un commentaire