2

I have uploaded codeigniter file in my linux server using php version 5.5. I got issue on application\config\autoload.php file.

$autoload['libraries'] = array(); //default code
//$autoload['libraries'] = array('database');

When i run the program using default code. program runs fine. But when i load database library, we didn't get any error or output. it shows blank page.

you can check here.

Sample Code:

class Test extends CI_Controller {  

    function show() {   
        echo 'methos call';
    }
}

This program runs in my local without issue. Is that server problem or codeignitor issue.

Thanks

Ziem
  • 6,579
  • 8
  • 53
  • 86
Narendra Verma
  • 195
  • 1
  • 13

3 Answers3

1

In autoload.php file Change

$autoload['libraries'] = array('database')

Then go to database.php and configure your database.(Bottom of page).

if CodeIgnitor 2.0.0

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '';
$db['default']['password'] = '';
$db['default']['database'] = '';//database name
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

If CodeIgnitor 3.0.0

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

If you correct these it should work fine.

Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85
1

If the code is running fine on local machine and giving problem on server please check the name of file. It should in lowercase and the class name should in camelcase. It worked for me please try.

Nishant Nair
  • 1,999
  • 1
  • 13
  • 18
  • This is a good point to care about but it could not be correct here because links such as "http://www.mycrushsocial.com/Test/show" or "http://www.mycrushsocial.com/Test/Show" are showing error 404 page not found. – Mojtaba Rezaeian May 20 '15 at 15:02
0

Try using following code,

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors',1);
ini_set('html_errors', 1);

It will show all the errors which sometimes hidden by default.

Arnab Nandy
  • 6,472
  • 5
  • 44
  • 50
  • Thanks for responding I tried both but still we are facing issue. Is it any other issue. – Narendra Verma Apr 23 '15 at 13:21
  • I tried hole day for troubleshooting. But i didn't get exactly what is the problem on loading $autoload['libraries'] = array('database');. I found stack overflow link about this type of issue Problem with database in CodeIgniter Unable to auto/manually load database library in codeigniter Please suggest if any other solution for this issue. – Narendra Verma Apr 23 '15 at 13:23
  • This would make all errors visible in a PHP page so if there is any error it will be shown, if there is nothing showing it possibly a problem with your route.php page – Arnab Nandy Apr 23 '15 at 13:24