1

my init.php Here's the code of the connect in hosting but not working

$GLOBALS['config'] = array(
'mysql' => array(
    'host' => '127.0.0.1',
    'username' => 'root',
    'password' => '',
    'db' => 'db'
),
'remember' => array(
    'cookie_name' => 'hash',
    'cookie_expiry' => 604800
),
'sessions' => array(
    'session_name' => 'user',
    'token_name' => 'token'
));?>


and my db.php
Here's the code of the connect in hosting but not working and connect database web hosting, just show blank page in my hosting plz help me.

<?php

 class DB {
private static $_instance = null;
private $_pdo,
        $_query,
        $_error = false,
        $_results,
        $_count = 0,
        $_last_insert_id ;

private function __construct() {
    try {
        $this->_pdo = new PDO('mysql:host=' . Config::get('mysql/host') . ';dbname=' . Config::get('mysql/db'), Config::get('mysql/username'), Config::get('mysql/password') );
        $this->_pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES,TRUE);
    } catch(PDOException $e) {
        die($e->getMessage());
    }
}

public static function getInstance() {
    if(!isset(self::$_instance)) {
        self::$_instance = new DB();
    }
    return self::$_instance;
}
ahmad garmyani
  • 19
  • 1
  • 1
  • 2
  • A blank page is most likely a "500 server error", turn on error messages: http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php – JimL Jan 17 '16 at 21:06
  • thanks , right now show 500 Internal Server Error how to fix it ? – ahmad garmyani Jan 17 '16 at 21:49
  • Did you turn on error messages? – JimL Jan 17 '16 at 21:51
  • yes i did find the error Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. – ahmad garmyani Jan 17 '16 at 21:57
  • usually the root user dis activated on a shared hostings. Try to create a different user with the password. The code itself looks good – volkinc Jan 25 '16 at 16:54
  • thanks now working ... – ahmad garmyani Jan 26 '16 at 11:16

0 Answers0