Código PHP:
class SafePDO extends PDO {
public static function exception_handler($exception) {
// Output the exception details
die('Uncaught exception: ', $exception->getMessage());
}
public function __construct($dsn, $username='', $password='', $driver_options=array()) {
// Temporarily change the PHP exception handler while we . . .
set_exception_handler(array(__CLASS__, 'exception_handler'));
// . . . create a PDO object
parent::__construct($dsn, $username, $password, $driver_options);
// Change the exception handler back to whatever it was before
restore_exception_handler();
}
}
$dbh = new SafePDO('mysql:host=localhost;dbname=test', 'asdf', 'password');
Gatos fijate que prove de esa manera y me da un error 500... que estoy haciendo mal :/
Si tengo activado modulo pdo, y bueno no se que mas comprobar :/ gracias por la ayuda