Migration History PHP Error

Hi, I get the following error when I run yiic migrate history:

Total 19 migrations have been applied before:

PHP Error[2]: date(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Los_Angeles’ for ‘PDT/-7.0/DST’ instead

I have attempted this solution already after creating a demo by using yiic, got PHP error when surfer demo

I am wondering if their is a solution in the code rather than alter php.ini settings.

Thank You

There certainly is. Hint: The error message already gave that away ;)

Thanks for replying, I still get the error.I am putting it in main, but the migration is not picking it for some reason.

Er … what do you mean by “main” exactly? :huh:

sorry about saying main, I actually ment index.php before the application is ran.

Ah, okay. That will have little effect on the migrations. Just add that line to the very berginning of the offending migrations up() or safeUp() method.

Thanks you, I couldn’t find the migration that caused it, but I did find a way to fix it. I put the date_default_timezone_set(‘UTC’); in the yiic.php framework file.

I fix both index.php and console.php, like this (console.php):


$app = Yii::createConsoleApplication($config);



Are you sure you’ve fixed it properly?

You don’t need to mess around with yiic…