![]() |
SQL database connection errors suppressed - why? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: SQL database connection errors suppressed - why? (/showthread.php?tid=17873) |
SQL database connection errors suppressed - why? - El Forum - 04-18-2009 [eluser]Unknown[/eluser] I was really wondering why, after I tried connecting to a database using the CodeIgniter's functions, I just got a blank web page. No errors anywhere - not in CodeIgniter's, PHP's or Apache's logs. Digging further into CodeIgniter's source code, I was finally able to track down this line: @mysql_pconnect($this->hostname, $this->username, $this->password); So all connection errors are suppressed, and there's no way I could know what's wrong. Taking out the @-sign obviously helped. Shouldn't this definitely be changed? SQL database connection errors suppressed - why? - El Forum - 04-18-2009 [eluser]Mike Ryan[/eluser] Hi, The error checking is handled "above" the line you quoted: Code: //file system/database/DB_driver.php So, although the @ preceding the mysql_pconnect function call will suppress any errors, it will still return false and cause the error to be logged (albeit with limited information) by DB_Driver.php. You definitely should have seen something in CI's log - are you sure CI is able to write to log files, and has $config['log_threshold'] > 0 in config.php? |