Can't run yiic shell - only returns html in command line

I’m trying to upgrade to 1.1.1. I downloaded and installed a fresh copy of Yii 1.1.1. Created a fresh web app. Configured the main.php to connect to my MySQL database.

When I tried to run the shell, to build and model and crud classes I kept getting nothing but a bunch of html in the command line. It took me some time to figure out that yiic was failing because of a PHP warning, which was not showing up in the log, and just buried in the garbled output of the CL:

I’m not clear why a PHP warning forces yiic to completely fail but it does. The fix for me was to put the line:


in the main.php file.

Hope this helps!

Did you upgrade to PHP 5.3?

Because this is a requirement for PHP 5.3. Up to PHP 5.3 the date.timezone in php.ini was empty string and produced no errors.

From PHP 5.3 this setting is required so in php.ini you have to set date.timezone

I’m running PHP 5.3.1 and the time zone is set in the php.ini file. Even with the time zone set correctly in the php.ini file I got these errors.

Under the [Date] section I put in

date.timezone = America/New_York

in my php.ini, then stopped and restarted apache and it worked find. Gotta make sure you get the correct ini file if you’ve got more than one. Then I also put it in my main.php just in case the live server doesn’t have it and it causes fits later on.

That would be fine, except for the fact that

<?php phpinfo(); ?>

returns the correct timezone, indicating that my php.ini file is loading up just fine…


Did you check the other php.ini that is used for PHP on the command line?

As the warning message says you can try the date_default_timezone_set() function and in case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.

That helped my situation, thanks!

I was having the same situation, with a fresh install, adding this to config/main.php worked and so did modifying the php.ini file.

FYI I am using PHP 5.2.10 running Ubuntu on my DEV machine.

A couple of other things I learned that might help others.

A list of timezones here

To find out what ini files are being used at the command line type php --ini

Type php -i is the same output as phpinfo(); only command line.

Type php -v to find out what version of php you are running.

Hope this helps someone out.