Connect to MySQL database using PDO

Error message

Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; GeSHi has a deprecated constructor in require_once() (line 915 of /home/digipiph/public_html/sites/all/modules/libraries/libraries.module).

Below is how to set up a PDO connection to a MySQL database.

<?php
 
define('DATABASE','db_name');
define('DATABASE_USER','db_user');
define('DATABASE_PASSWORD','db_password');
 
try {
  $db = new PDO('mysql:host=localhost;dbname='.DATABASE,
DATABASE_USER, DATABASE_PASSWORD,array(
    PDO::ATTR_PERSISTENT => true
  ));
} catch (PDOException $e) {
  print "Error!: " . $e->getMessage() . "<br/>";
  die();
}
 
?>