PHP Classes

File: DbConfig.php

Recommend this page to a friend!
  Classes of Pierre-Henry Soria   Useful pH Classes   DbConfig.php   Download  
File: DbConfig.php
Role: Auxiliary script
Content type: text/plain
Description: Configuration script
Class: Useful pH Classes
Classes and functions for several purposes
Author: By
Last change:
Date: 2 days ago
Size: 850 bytes
 

Contents

Class file image Download
<?php
/**
 * @author Pierre-Henry Soria <ph7software@gmail.com>
 * @copyright (c) 2012, Pierre-Henry Soria. All Rights Reserved.
 * @link http://github.com/pH-7
 * @license CC-BY License - http://creativecommons.org/licenses/by/3.0/
 */

namespace PH7\Framework;
defined('PH7') or exit('Restricted access');
use
PH7\Framework\Db\Db;

try
{
    require
__DIR__ . '/Config/constants.php';

   
$aDriverOptions[\PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES UTF8';
   
Db::getInstance(
       
/* DSN */ 'mysql:host=' . PH7_DATABASE_HOST . ';dbname=' . PH7_DATABASE_NAME,
       
/* Username */ PH7_DATABASE_USER,
       
/* Password */ PH7_DATABASE_PASS,
       
/* Driver */ $aDriverOptions
   
);

}
catch (\
Exception $oE)
{
   
header('HTTP/1.1 500 Internal Server Error');
    exit(
'Could not connect to database server!');
}