CodeIgniter - blank page in autoload database

I get the problem this morning after I transferred my website from my local machine to the server.

To replace the context, I designed a website with a CodeIgniter framework and that’s all before the migration worked fine.

After a long study, it seems that when I put this:

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

I have a blank page on my site, no php / ci errors in logs.

And if I let this:

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

The website is working correctly (well, I cannot log in, but I do not have a blank page).

I added mysql.so to the php.ini file, but that didn't help me either.

Has anyone already encountered this problem? How can you solve this?

Thanks!

IN

+6
source share
11 answers

Are you sure your credentials for connecting to the Internet are correct? If you switch servers, it seems like this could be a problem.

In addition, CodeIgniter sets error_reporting (0) for production environments --- hence a blank page. Check the log file (is it written in the web server process ..?) For any other information.

+2
source

in the /config/database.php application make sure that

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

set to

 $db['default']['dbdriver'] = 'mysqli'; 
+7
source

I had a similar problem with blank pages that are apparently related to loading the database, whether through autoload or calling $this->load->database(); in the model constructor. I had to modify the "php.ini" file by commenting on extension=php_pdo_mysql.dll and uncommenting extension=php_mysql.dll (i.e. by disabling PDO). I am running Windows 8.1, Apache 2.2 and PHP 5.3.27.

This answer is similar to another, but I could not add a comment for clarification, since I just signed up. It took me a couple of hours and many of Google decided to allow, so hopefully this helps someone.

+4
source

Reboot the web server and try again.

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

 <?php phpinfo(); ?> 

check if mysql extension is loading if loading it

try making chmod 0777 on your directoy

+1
source

This happens when you don't have mysql module to install php. On Windows, I believe this happens with the php installer. If you are running Linux, such as Fedora, this is how you install it:

sudo yum -y install php-mysql

Reboot the web server after installation. Assuming you are using apache httpd:

sudo service httpd restart

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

+1
source

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

The problem was that in the database configuration file I used MYSQL as a driver, when he installed MYSQLI on the server, just change it in the configuration file, and you're done.

Hope this helps someone.

+1
source

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

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

0
source

For me, having the same problem using Z-WAMP, I had to uncomment "extension = php_mysql.dll" from php.ini. "Mysql.default_port = 3306" and "mysql.default_host = localhost" are also assigned. Hope this helps someone out there.

0
source

For those using linux (esp. Ubuntu) and still getting a blank page, follow these steps:

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

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

0
source

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

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

Replace 'mysql' with 'mysqli'

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

what is it!

0
source

Source: https://habr.com/ru/post/892685/


All Articles