My project worked in localhost, but showing error on server:
Asked
Active
Viewed 210 times
-1

Brian Tompsett - 汤莱恩
- 5,753
- 72
- 57
- 129

gokul
- 41
- 1
- 6
-
check for white space before php tag or some output is generating before exicuting code – Vision Coderz Oct 19 '16 at 05:04
-
Look at the fatal error first. Figure out why `mysqli` failed. – chris85 Oct 19 '16 at 05:06
-
It could be your hosting does not support the whole functionalities of the Database Drtiver you can head to **Application/config/database.php** and change these line from ` 'dbdriver' => 'mysqli',` to `'dbdriver' => 'pdo',` – Abolarin stephen Oct 19 '16 at 05:10
-
it would be nice if you post your database.php and also go to `Application/Logs` and open the log dated today additional error information may be in the file – Abolarin stephen Oct 19 '16 at 05:13
1 Answers
0
Try this
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root', # check username
'password' => '', # check password
'database' => 'shortagesdb', # check DB name is correct
'dbdriver' => 'mysqli', # remove mysql
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'), # remove 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
or may be
It is not a bug in your application, it is just a missing driver, so, you have couple of options...
Go to your php init and uncomment the following:
extension=php_mysqli.dll
If not, try installing it at your server, it varies depending on your distribution.
Try installing php5-mysqlnd
If you cannot do it by hosting restrictions then just move to mysql driver (wont need to change other configurations or queries in CodeIgniter or anything else...)
like this (at your config file)
$db['default']['dbdriver'] = 'mysql'; (you might have mysqli now)
source Codeigniter: fatal error call to undefined function mysqli_init() and CodeIgniter error when connecting to any database

Community
- 1
- 1

Abhijit Jagtap
- 2,740
- 2
- 29
- 43
-
-
they told that this is a virtual server so they are not able to provide a tech support – gokul Oct 20 '16 at 05:33
-
check this link might be help full to you http://www.webhostingtalk.com/showthread.php?t=540760 – Abhijit Jagtap Oct 20 '16 at 06:19
-
Cannot modify header information - headers already sent by (output started at /home/medmaacom/public_html/application/models/User_model.php:167) – gokul Oct 20 '16 at 08:06
-
-
check http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php – Abhijit Jagtap Oct 20 '16 at 10:37