Home > Blockchain >  How to call function from another class in the widget array?
How to call function from another class in the widget array?

Time:07-07

I have a yii application. And I am using the

widget('bootstrap.widgets.TbGridView

and in the column value of the widget I have this function:

<div>
<div >
    
  </div>
</div>

And the model Resul looks like this:


class Result extends \CActiveRecord
{   

        return $result->number;
    }
}

But when I load the page I get this error:

Fatal error: Maximum execution time of 120 seconds exceeded in C:\xampp\htdocs\webScraper\protected\modules\scrape\models\Result.php on line 57

So my question is. How to resolve this?

CodePudding user response:

try adding bellow line to your php code :

set_time_limit(1120);

or, you can edit php.ini changing value max_execution_time to :

max_execution_time = 1120

Sure, you can use a bigger or smaller execution time, acording to your needs.

1120 comes just by adding 1000 to your current execution time (1000 120 = 1120).

Since you are using xampp, you can find php.ini under C:/xampp folder/php/php.ini.

When you move from xampp to a hosting company, you can also edit max_execution_time from your administration panel of your host, or contact hosting company to change it.

You can also try to set you max_execution_time to infinity by :

set_time_limit(0);

or

max_execution_time = -1

Only for debug purposes, since it's not the best practice fro security and practical reasons. This way, a malicious script may keep using resources until your server gets down.

Extra, you can try to set max execution time by creating/editing your .htaccess file in the root of the project. This way you are going to have same setting when you move your project from xampp.

Still, you need your host to allow modification fo that setting, else you can for it.

php_value max_execution_time 30
  • Related