I'm pretty much new to PHP and I'm having a very basic problem which I haven't found a solution to despite looking through similar questions in the forum.
I'm trying to connect PHP with my database (MySQL) through PDO. If I enter a wrong username or password php does show an error in the browser but if I enter a wrong database name it doesn't retireve any errors. How is this possible? My code is as follows:
<?php
try{
$conn = new PDO('mysql:127.0.0.1;dbname=myDb','root','root');
$conn -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOexception $e){
echo 'wrong credentials';
}
My php.ini file is configured to show errors and Apache was restarted after modifying it with the following values:
error_reporting = E_ALL | E_STRICT
display_errors = On
display_startup_errors = On
log_errors = On
I also tried to use the following code at the begining of my script but it still doesn't show errors related to a wrong database name
ini_set('display_errors', 1);
error_reporting(~0);
Thanks a lot in advance for your help, I'm sure is probably a pretty stupid thing but I honestly can't figure it out.
$conn->errorInfo()
show you?