ajax call response in 500 only for long time scripts

Hi everyone,

the problem is that long time ajax calls return "Internal Server Error" at the end of script execution. There are no server errors and without ajax script is running perfectly. Strange thing that with ajax script runs perfectly too but response code is 500. Also if script execution time is not big (maybe less than 15-20 sec), same code works fine (my max_execution_time = 30), other way returns 500. In Mozilla debug console return data is correct with status 500.

I have tried disabling Csfr for action/controller/whole project, setting timeout for ajax/script but nothing helps at all. Need your help very very much.

Ajax part:


    url: '/admin/supplier-analyze/start/',

    type: 'post',

    data: {

        columns: JSON.stringify(res)


    success: function (data) {

         //success code     




               alert('You are offline!!\n Please Check Your Network.');

           }else if(x.status==404){

               alert('Requested URL not found.');

           }else if(x.status==500){

                alert('Internel Server Error.');

           }else if(e=='parsererror'){

                alert('Error.\nParsing JSON Request failed.');

           }else if(e=='timeout'){

               alert('Request Time out.');

           }else {

                alert('Unknow Error.\n'+x.responseText);




Controller for ajax call:

public function actionStart() {

    if (Yii::$app->request->isAjax) {


        $data = Yii::$app->request->post();


        //some operations

        echo "some string";