Yii Application unresponsive when controller action is running

Hi there,

I just started creating an app using Yii lately and for the most part the application is very fast. I have one controller action that takes a very long time (10 minutes plus). This is expected and fine, the action communicates with remote servers and I put set_time_limit(0) in the action. The problem is that the rest of the yii application is unresponsive when it is running. I can’t load the home page, the contact page, or anything else until it finishes.

My questions are:


[*]What could be causing this, and how can I resolve it?

[*]Is there a better way to let a very slow controller action run until completion than using set_time_limit = 0 in the controller action?


This is running on my local apache server with debug mode turned on. Thanks for your help.

This might help:


Also read this:


you can use a background job to communicate with remote server.

Thanks for the links outrage, very helpful. I now have the controller action successfully running in the background with ERunActions::runBackground(). A new problem is that now it no longer runs to completion (it previously took around 2 hours…there are sleep(s) in it in order to comply with third party API rate limiting). It seems to run for 10 minutes or so in the background then just stops. The set_time_limit(0) I added doesn’t seem to be taking effect, below is the relevant code:

if (ERunActions::runBackground() && isset($_GET['type']) && isset($_GET['set']))



   // some very time consuming functions here


} else {



So I couldn’t quite figure out how to get this working well as a controller action, so what I ended up doing was taking the whole controller action and converting it into a console command using a different Yii application config, etc.

This works well.