I have create register and login form using php. And i had took the source from google.
So i have added all the corresponding code, when run index.php.
It shows,
SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
I tried for fixing this problem using stackoverflow and google, still can't to rectify.
I Am using xampp. In xampp control panel, apache and mysql modules are running. and apache port is 80,443 and mysql port is 3306.
May i know, any other my mistake?..
Can someone help me? Any help would be appreciated.
Thanks in advance.
This is my config.php:
<?php
ob_start();
session_start();
//set timezone
date_default_timezone_set('Europe/London');
//database credentials
define('DBHOST','localhost');
define('DBUSER','root');
define('DBPASS','');
define('DBNAME','register');
//application address
define('DIR','http://domain.com/');
define('SITEEMAIL','[email protected]');
try {
//create PDO connection
$db = new PDO("mysql:host=".DBHOST.";port=8889;dbname=".DBNAME, DBUSER, DBPASS);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
//show error
echo '<p class="bg-danger">'.$e->getMessage().'</p>';
exit;
}
//include the user class, pass in the database connection
include('classes/user.php');
$user = new User($db);
?>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…