Yii Framework Forum: How to change max execution time - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

How to change max execution time Fatal error: Maximum execution time of 60 seconds exceeded in D:\works Rate Topic: -----

#1 User is offline   bytefrog 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 08-February 10

Posted 08 February 2010 - 08:48 AM

Hi all, Can anybody help me how to change the Maximum execution time of this framework. I got this error when processing 4,312 records.

Here is my function:

public function synchronizeUsers() {
$encrypter = new crypt;
$encrypter->crypt_key(Yii::app()->params['crypt_key']);
$emp = Yii::app()->db->createCommand("SELECT EMP_NO, EMP_LNAME, EMP_FNAME, EMP_MNAME, EMP_EMAIL FROM EMPLOYEE LEFT JOIN Users On EMPLOYEE.EMP_NO = Users.empno WHERE Users.empno is null");
$dataReader=$emp->queryAll(); // execute a query SQL
//print_r($dataReader);
//$rows = $dataReader->read();
$sql="INSERT INTO users (username,password, email,empno) VALUES(:username,:password,:email,:empno)";
$command= Yii::app()->db->createCommand($sql);
foreach($dataReader as $row ) {
try {
//username of the user for temporary fname+empno
$username = $row['EMP_FNAME'].$row['EMP_NO'];
$command->bindParam(":username",$username,PDO::PARAM_STR);
//password is compose of lname+empno
$password = $encrypter->encrypt(trim($row['EMP_LNAME']).$row['EMP_NO']);
$command->bindParam(":password",$password,PDO::PARAM_STR);
$command->bindParam(":email",$row['EMP_EMAIL'],PDO::PARAM_STR);
$command->bindParam(":empno",$row['EMP_NO'],PDO::PARAM_STR);
//$command->bindParam(":access",0,PDO::PARAM_INT);
//$command->bindParam(":status","A",PDO::PARAM_STR);
$command->execute();
}
catch(Exception $e) {

}
}

}



I got a Fatal error: Maximum execution time of 60 seconds exceeded in D:\workspace\php\htdocs\yii\framework\db\CDbCommand.php on line 193
0

#2 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,016
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 08 February 2010 - 08:49 AM

You need to change that in the php.ini:

max_execution_time = 30

0

#3 User is offline   andy_s 

  • Random Member Title
  • Yii
  • Group: Moderators
  • Posts: 1,526
  • Joined: 22-June 09
  • Location:Russia, Kostroma

Posted 08 February 2010 - 09:08 AM

In your php script:

set_time_limit(180); // Set max execution time 3 minutes.

0

#4 User is offline   bytefrog 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 08-February 10

Posted 08 February 2010 - 07:22 PM

Thanks guys.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users