self.li - note to self and share with others, blog by Peter Legierski

Peter Legierski

/pronounced as leg-year-ski/

Occasional workaholic, regular teaholic. Maker of things. Fat, powdered nose, indoor climber!

Currently working on my personal project MRR.io. Check it out!

CodeIgniter timing out after 300s ? Here’s a solution

Hey CodeIgniter developers, here’s another thing to look out for when developing with our favourite framework. We ran into this issue here at GatherContent a little while ago, trying to figure out why PHP scripts triggered from CLI would always time out after 300s, even though every possible setting on the server was set to much higher values.

Turns out CodeIgniter overwrites time limit that you set on your server with a “liberal” (according to CI team) limit of 300s. Take a look:

(system/CodeIgniter.php, lines 100-108)

The problem is that 300s is way too long for a front end parts of your app (no one’s going to wait that long for a page to load), and way too short for back end parts of your app (scripts generating massive PDF’s for example). It might be ok for most people most of the time, but it might bite you badly one day and you’ll waste your time trying to figure out why the heck your code times out.

The best fix is probably to comment out entire section and let your server decide how long to run scripts for. No more unexpected behaviour.

And if you read that far, check out another unexpected CodeIgniter issue that I found a while ago.

Recommend:
Posted 13 years ago - Comments
  1. blog-self-li posted this
#codeigniter #fix #time out #error #solution #php #debugging