6

I encouter a problem since this morning, after I migrated my website from my local machine to the server.

To replace the context, I developed a website with the framework CodeIgniter, and everything before the migration was working fine.

After a long research, it seems that when i put this :

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

I have a blank page on my website, without any php/ci errors in the logs.

And if I let this :

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

The website is working correctly (well, I can't log in but I don't have a blank page).

I added the mysql.so in the php.ini file, but it didn't help me neither.

Does someone already encountered this problem ? How can you solved it please ?

Thanks !

B

BMN
  • 8,253
  • 14
  • 48
  • 80

11 Answers11

7

in application/config/database.php check that

$db['default']['dbdriver'] = 'mysql';

is set to

$db['default']['dbdriver'] = 'mysqli';
Mancy
  • 319
  • 3
  • 5
4

I had a similar problem with blank pages seemingly associated with loading the database, be it via autoload or calling $this->load->database(); in the model constructor. I ended up having to modify my 'php.ini' file by commenting out extension=php_pdo_mysql.dll and uncommenting extension=php_mysql.dll (i.e. turning PDO back off). I am running Windows 8.1, Apache 2.2, and PHP 5.3.27.

This answer is similar to another, but I couldn't add a comment for clarification since I just signed up. It took me a couple of hours and a lot of Googling to resolve, so hopefully this helps somebody.

Tim
  • 1,199
  • 1
  • 7
  • 10
2

Are you sure your db connection credentials are correct? If you switchd servers this seems like it might be the issue.

Additionally, CodeIgniter sets error_reporting(0) for production environments --- hence the blank page. Check your logs dir (is it writeable by the webserver process..?) for any other info.

jlb
  • 19,090
  • 8
  • 34
  • 65
  • I tried to connect with the commandline and everything was OK so I presume it won't be a problem to have the same credentials in database.php file – BMN Jul 13 '11 at 14:30
  • I also have : error_reporting(E_ALL); and the only line in the log concerning the db is : DEBUG - 2011-07-13 16:37:57 --> Database Driver Class Initialized – BMN Jul 13 '11 at 14:35
  • search your app (from the root dir) for any other instances of "error_reporting" -- CI may be overriding the setting after you – jlb Jul 13 '11 at 14:38
  • check your webserver or php logs, (php log location should be visible in php.ini), webserver logs location depend on the server.. – jlb Jul 13 '11 at 14:43
  • That's what I said in the post, I have no php or apache errors :( – BMN Jul 13 '11 at 14:45
  • No i don't have anything of it. – BMN Jul 13 '11 at 15:00
  • OK it seems to be a mysql error. I remove the @ before the mysql_connect in the system/database/drivers/mysql/mysql_driver.php and I got this error : Fatal error: Call to undefined function mysql_connect() in path_to_my_site/system/database/drivers/mysql/mysql_driver.php on line 70. I'll check for the mysql version then... – BMN Jul 13 '11 at 15:45
1

I have just had this error, after debugging the MYSQL driver I figure out the problem.

The problem was that on the database config file I was using MYSQL as a driver when on the server it has installed MYSQLI, just change it on the config file and you're done.

Hope this helps someone.

yuukan
  • 61
  • 5
1

Please restart your webserver and try again.

create a new info.php file with phpinfo();

<?php

phpinfo();

?>

see if the mysql extension is loading if its loading

try to do a chmod 0777 to your directoy

1

This happens when you don't have mysql module for php installed. In windows, I believe this comes with the php installer. If you are on linux, for example on Fedora, this is how you install it:

sudo yum -y install php-mysql

Restart the webserver after the installation. Assuming you are using apache httpd:

sudo service httpd restart

Now you should see the pages again (assuming you have correct settings in conf/database.php).

Kaushalya
  • 1,009
  • 1
  • 10
  • 10
0

For me, having the same issue using Z-WAMP, had to uncomment "extension=php_mysql.dll" from the php.ini. Also assigned "mysql.default_port = 3306" and "mysql.default_host = localhost". Hope it helps someone out there

ivansabik
  • 585
  • 4
  • 13
0

For those using linux (esp. ubuntu) and are still getting the blank page, do the following:

  1. sudo apt-get install php5 libapache2-mod-php5 php5-mysql php5-cli mysql-server
  2. sudo service apache2 restart
  3. $autoload['libraries'] = array('database');
0

Installing php5-pgsql fixed it for me (on Ubuntu)

John Kentucky
  • 876
  • 6
  • 10
0

just go to application/config/database.php and find

$db['default']['dbdriver'] = 'mysql';

Replace 'mysql' with 'mysqli'

$db['default']['dbdriver'] = 'mysqli';

and that's it!

0

It sounds like your database is not configured properly and your PHP installation is blocking the errors.

Take a look at your log files or try putting

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

in your index.php and see what you get

Swift
  • 13,118
  • 5
  • 56
  • 80
  • that is turned off in codeigniter configuration, that won't work – Christophe Jul 13 '11 at 14:31
  • The db parameters seems to be OK as I can connect it with the commandline, and I can reached it on my machine. The DB server is not local aswell. – BMN Jul 13 '11 at 14:31