简体   繁体   中英

blank page when using PostgreSQL database in CodeIgniter

I'm developing a PHP application using CodeIgniter as the framework, and PostgreSQL as the database. In \\application\\config\\database.php I have the following configuration:

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '<myusername>';
$db['default']['password'] = '<mypassword>';
$db['default']['database'] = 'heatmap';
$db['default']['dbdriver'] = 'postgre';
$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;

When I try to load my http://localhost/heatmap/ page I only get a blank page. Nothing is displayed, and the page source is empty as well. No error thrown. I'm only trying to load the default page that comes with CodeIgniter. I did googled this problem, and none of the related problems I found solved my problem. My Postgres version is 9.1 , PHP is 5.3.8 .

I can only say what helped me. I just realized that i don't have php-postgre drivers in my system (Debian) Installing php5-pgsql worked for me. After this i had to set the

$db['default']['db_debug'] = FALSE;

And now everything works just fine.

Check php.ini: extension=php_pgsql.dll

Check httpd.conf: LoadFile "C:/Program Files/PostgreSQL/9.3/bin/libpq.dll"

Reboot the apache.

Are you sure that the problem is caused by your database(configuration)? The default controller does not interact with the database and the database class is not loaded by default.

If you did load the database class yourself using $this->load->database(); then remove it and see if the default page is being displayed.

I would also recommend turning error_reporting() on so you can look through the logs and see what happens. More info on that topic can be found here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM