Can't run shell command

Shell Command not working.

From the www/demo2 folder, I run: yiic shell

and get this error:





<!DOCTYPE html PUBLIC

	"-//W3C//DTD XHTML 1.0 Transitional//EN"

	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title>

PHP Error</title>


<style type="text/css">

/*<![CDATA[*/

body {font-family:"Verdana";font-weight:normal;color:black;background-color:white;}

h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }

h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }

h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}

p {font-family:"Verdana";font-size:9pt;}

pre {font-family:"Lucida Console";font-size:10pt;}

.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}

.message {color: maroon;}

.source {font-family:"Lucida Console";font-weight:normal;background-color:#ffffee;}

.error {background-color: #ffeeee;}

/*]]>*/

</style>

</head>


<body>

<h1>PHP Error</h1>


<h3>Description</h3>

<p class="message">

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 '-7.0/DST' instead</p>


<h3>Source File</h3>

<p>

C:\Program Files\EasyPHP-5.3.3\www\demo2\protected\views\layouts\main.php(47)</p>


<div class="source">

<pre>

00035:                 array('label'=&gt;'Logout ('.Yii::app()-&gt;user-&gt;name.')', 'url'=&gt;array('/site/logout'), 'visible'=&gt;!Yii::app()-&gt;user-&gt;isGuest)

00036:             ),

00037:         )); ?&gt;

00038:     &lt;/div&gt;&lt;!-- mainmenu --&gt;

00039: 

00040:     &lt;?php $this-&gt;widget('zii.widgets.CBreadcrumbs', array(

00041:         'links'=&gt;$this-&gt;breadcrumbs,

00042:     )); ?&gt;&lt;!-- breadcrumbs --&gt;

00043: 

00044:     &lt;?php echo $content; ?&gt;

00045: 

00046:     &lt;div id=&quot;footer&quot;&gt;

<div class="error">00047:         Copyright &amp;copy; &lt;?php echo date('Y'); ?&gt; by My Company.&lt;br/&gt;

</div>00048:         All Rights Reserved.&lt;br/&gt;

00049:         &lt;?php echo Yii::powered(); ?&gt;

00050:     &lt;/div&gt;&lt;!-- footer --&gt;

00051: 

00052: &lt;/div&gt;&lt;!-- page --&gt;

00053: 

00054: &lt;/body&gt;

00055: &lt;/html&gt;</pre>

</div><!-- end of source -->





<h3>Stack Trace</h3>

<div class="callstack">

<pre>

#0 C:\Program Files\EasyPHP-5.3.3\www\demo2\protected\views\layouts\main.php(47): date()

#1 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\CBaseController.php(119): require()

#2 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\CBaseController.php(88): SiteController-&gt;renderInternal()

#3 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\widgets\CContentDecorator.php(78): SiteController-&gt;renderFile()

#4 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\widgets\CContentDecorator.php(56): CContentDecorator-&gt;decorate()

#5 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\widgets\COutputProcessor.php(45): CContentDecorator-&gt;processOutput()

#6 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\CBaseController.php(199): CContentDecorator-&gt;run()

#7 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\CBaseController.php(294): SiteController-&gt;endWidget()

#8 C:\Program Files\EasyPHP-5.3.3\www\demo2\protected\views\layouts\column1.php(7): SiteController-&gt;endContent()

#9 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\CBaseController.php(119): require()

#10 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\CBaseController.php(88): SiteController-&gt;renderInternal()

#11 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\CController.php(741): SiteController-&gt;renderFile()

#12 C:\Program Files\EasyPHP-5.3.3\www\demo2\protected\controllers\SiteController.php(32): SiteController-&gt;render()

#13 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\actions\CInlineAction.php(50): SiteController-&gt;actionIndex()

#14 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\CController.php(300): CInlineAction-&gt;run()

#15 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\CController.php(278): SiteController-&gt;runAction()

#16 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\CController.php(257): SiteController-&gt;runActionWithFilters()

#17 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\CWebApplication.php(324): SiteController-&gt;run()

#18 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\web\CWebApplication.php(121): CWebApplication-&gt;runController()

#19 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\base\CApplication.php(135): CWebApplication-&gt;processRequest()

#20 C:\Program Files\EasyPHP-5.3.3\www\demo2\index.php(13): CWebApplication-&gt;run()

#21 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\cli\commands\ShellCommand.php(78): require()

#22 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\console\CConsoleCommandRunner.php(62): ShellCommand-&gt;run()

#23 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\console\CConsoleApplication.php(88): CConsoleCommandRunner-&gt;run()

#24 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\base\CApplication.php(135): CConsoleApplication-&gt;processRequest()

#25 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\yiic.php(33): CConsoleApplication-&gt;run()

#26 C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\yiic(15): require_once()

</pre>

</div><!-- end of callstack -->


<div class="version">


Warning: 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 '-7.0/DST' instead in C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\views\exception.php on line 71

2010-09-26 16:39:33 <a href="http://www.yiiframework.com/">Yii Framework</a>/1.1.4</div>

</body>

</html>



Hi. I’ve just joined the forums and was about to post my first query when I saw this - as I’ve been through the 5.2 to 5.3 migration process, I thought I’d just comment here first as it may help you out.

As of 5.3, you must set your timezone in the php.ini file. I believe that this is for security purposes.

eg mine is set to:

date.timezone = "Europe/London"

See more info here:

http://blogs.iis.net/donraman/archive/2009/10/08/upgrading-to-php-5-3-an-easy-way.aspx

(It’s an IIS-focused blog, but the 5.3 stuff is relevant to PHP under Apache/other too)

Hope this helps!

PS - the other thing that really threw me when moving to 5.3 was the way that config files are parsed. 5.3 is much stricter it seems, and quite a few of our existing Zend framework config files appeared to have comments using a wrong format that ZF under 5.2 simply seemed to ignore. With 5.3, the app just stopped dead.

Edit corrected incorrect spelling.

Thanks for the help Sparrowhawk, I added that line in the php.ini file but it didn’t help.

Then try putting this in on top of your entry script:


date_default_timezone_set('Europe/London');

All right, it worked by putting that line in the yiic file in the framework folder.

That’s a bizarre hack. Any more hacks to know about?




#!/usr/bin/env php

<?php

/**

 * Yii command line script for Unix/Linux.

 *

 * This is the bootstrap script for running yiic on Unix/Linux.

 *

 * @author Qiang Xue <qiang.xue@gmail.com>

 * @link http://www.yiiframework.com/

 * @copyright Copyright &copy; 2008 Yii Software LLC

 * @license http://www.yiiframework.com/license/

 * @version $Id: yiic 702 2009-02-18 19:29:48Z qiang.xue $

 */


date_default_timezone_set('Europe/London');

require_once(dirname(__FILE__).'/yiic.php');

Well, usually you should set it in the php.ini. Sometimes you may have 2 php.ini’s (one for console version of php, one for apache php module).

And of course when you change php.ini you have to restart PHP (Apache) so that the new settings take effect…

Use this command to find the right ini file for the command line version of PHP:


php --ini