2016-03-20 15 views
0

Bir Veritabanı Hatası kullanarak veritabanı sunucusuna bağlantı kurulamıyor sağlanan ayarları kullanarak veritabanı sunucusuna bağlanmak için CodeIgniter'ın: sağlanan

açılamıyor

Oluştu.

Dosya adı: kütüphaneler/Oturum/Session.php

Hat Sayısı: 102

Ben bu hatası alıyorum benim web sitesine Db başlayıp bilmiyorum gitti CI için deneyimsizim nasıl reslove edilir.

Bu hatayı giderebilir misiniz, lütfen?

application/config/DatabaseFunctions.php

$active_group = 'default'; 
    $query_builder = TRUE; 
    require_once('mainconfig.php'); 
$db['default'] = array(
     'dsn' => '', 
     'hostname' => $config['mysql_host'], 
     'username' => $config['mysql_username'], 
     'password' => $config['mysql_password'], 
     'database' => $config['mysql_database'], 
     'dbdriver' => $config['mysql_driver'], 
     'dbprefix' => '', 
     'pconnect' => FALSE, 
     'db_debug' => TRUE, 
     'cache_on' => FALSE, 
     'cachedir' => '', 
     'char_set' => $config['mysql_charset'], 
     'dbcollat' => $config['mysql_dbcollat'], 
     'swap_pre' => '', 
     'encrypt' => FALSE, 
     'compress' => FALSE, 
     'stricton' => FALSE, 
     'failover' => array(), 
     'save_queries' => TRUE 
); 

application/config/mainconfig.php

defined('BASEPATH') OR exit('No direct script access allowed'); 
$config['mysql_host'] = 'localhost'; 
$config['mysql_username'] = 'xxxcc'; 
$config['mysql_password'] = 'xxxcc'; 
$config['mysql_database'] = 'xxccv'; 
$config['mysql_driver'] = 'mysqli'; 
$config['mysql_charset'] = 'utf8'; 
$config['mysql_dbcollat'] = 'utf8_general_ci'; 
$config['base_js'] = 'assets/js'; 
$config['base_css'] = 'assets/css'; 
$config['base_plugins'] = 'assets/plugins'; 
$config['base_images'] = 'assets/images'; 
$config['base_fonts'] = 'assets/font-awesome'; 
$config['other_base'] = 'assets/fonts'; 
$config['email_author'] = '[email protected]'; 
$config['limit'] = 7; 
+0

Uygulamada veritabanı bağlantısını denetle/config/database.php –

+0

Daha fazla bilgi gerekiyor. – user4419336

cevap

0

u sonra php en son sürümünü kullanın lütfen 3 CodeIgniter kullanırsanız. Bir kez bu hataları aldım ama sonra php'yi güncellerim, sonra projemde başarıyla kod kurucuyu kurduktan sonra çalışır.

Ve uygulamanızda takip edin/config/DatabaseFunctions.php

$active_group = 'default'; 
$query_builder = TRUE; 

$db['default'] = array(
    'dsn' => '', 
    'hostname' => 'localhost', 
    'username' => 'root', 
    'password' => '', 
    'database' => 'db_bdtimes', // your database name 
    'dbdriver' => 'mysqli', 
    'dbprefix' => '', 
    'pconnect' => FALSE, 
    'db_debug' => (ENVIRONMENT !== 'production'), 
    'cache_on' => FALSE, 
    'cachedir' => '', 
    'char_set' => 'utf8', 
    'dbcollat' => 'utf8_general_ci', 
    'swap_pre' => '', 
    'encrypt' => FALSE, 
    'compress' => FALSE, 
    'stricton' => FALSE, 
    'failover' => array(), 
    'save_queries' => TRUE 
); 
+0

php 5.5 kullanıyorum ve 5.6'ya yükseltmem gerekiyor mu? – Oryzxo

+0

Bir şans verelim! Ama projeniz için bir veritabanı hazırladınız mı? –

+0

Projem için veritabanı oluşturmayı başardım. 1 – Oryzxo

0

Sadece değiştirmek ve emin

$ db için çalışacak [ 'default'] [ 'hostname'] = 'localhost ';

için

$ db [ 'default'] [ 'hostname'] = '127.0.0.1';

İlgili konular