Reputation: 430
I'm running a small webservice that gets data from a user specified database, and some of those queries are heavy and often take longer than usual, because those rows contain base64 images and other needed stuff. When my queries take longer than 30 secs CI crashes somehow. I've tried using $this->db->_error_number()
, $this->db->_error_message()
and
if ($this->db->trans_status() === FALSE) {
die('Wops, something weird happened...');
}
But none of them gives me error infos. Anybody knows how to capture those timeout errors and echo them to the user? Thanks.
EDIT:
log output:
...
DEBUG - 2015-04-10 10:34:34 --> Controller "Main" Initialized
DEBUG - 2015-04-10 10:34:34 --> Helper loaded: log_helper
DEBUG - 2015-04-10 10:34:34 --> Database Driver Class Initialized
DEBUG - 2015-04-10 10:35:04 --> Final output sent to browser
DEBUG - 2015-04-10 10:35:04 --> Total execution time: 30.0145
...
Upvotes: 0
Views: 3919
Reputation: 1904
Please check mysql.connect_timeout parameter in your phpinfo() and increase in in case require as this may be reason for query timeout.
You can read more about this Here
Upvotes: 3
Reputation: 53
Your query takes too much time. If your are using webserver(nginx or apache) hey have default timeout. In most cases it 30seconds. You can increase timeout time on your webserver.
Also check php timeout parameters in php.ini max_execution_time
Or try to set_time_limit
bigger directly in php code.
http://php.net/manual/en/function.set-time-limit.php
Upvotes: 1