I already asked this is the appropriate forum related to
Agile Web Application Development with Yii 1.1 and PHP5
but not getting any leads there so trying here.
I am trying to run the Yiic shell to execute a custom rbac command that propagates a user access scheme in the TrackStar application in the book.
However I cannot load the Yiic shell.
If i go to my project directory and excecute:
users-MacBook-Air:trackstar user$ protected/yiic shell
I get output like this instead of a shell launch.
....
<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;}
....and so on...
If I go directly to the yiic tool:
protect/yiic shell
I get output like this:
users-MacBook-Air:protected user$ ./yiic shell
Error: index.php does not exist or is not an entry script file.
USAGE
yiic shell [entry-script | config-file]
DESCRIPTION
This command allows you to interact with a Web application
on the command line. It also provides tools to automatically
generate new controllers, views and data models.
It is recommended that you execute this command under
the directory that contains the entry script file of
the Web application.
PARAMETERS
* entry-script | config-file: optional, the path to
the entry script file or the configuration file for
the Web application. If not given, it is assumed to be
the 'index.php' file under the current directory.
And am returned to my prompt.
If I do something like
./yiic shell ../index.php
I once more get the html output.
I am using Yii 1.1.2 (the version the book uses) with the latest MAMP and OS X 1.7.2
Any help would be great appreciated!
thanks
update: I have captured the shell output and it is as follow:
PHP Error
Description
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 'Europe/Paris' for 'WEST/1.0/DST' instead
Source File
/Users/user/Dropbox/localhost/trackstar/protected/views/layouts/main.php(47)
00035: array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)
00036: ),
00037: )); ?>
00038: </div><!-- mainmenu -->
00039:
00040: <?php $this->widget('zii.widgets.CBreadcrumbs', array(
00041: 'links'=>$this->breadcrumbs,
00042: )); ?><!-- breadcrumbs -->
00043:
00044: <?php echo $content; ?>
00045:
00046: <div id="footer">
00047: Copyright © <?php echo date('Y'); ?> by My Company.<br/>
00048: All Rights Reserved.<br/>
00049: <?php echo Yii::powered(); ?>
00050: </div><!-- footer -->
00051:
00052: </div><!-- page -->
00053:
00054: </body>
00055: </html>
Stack Trace
#0 /Users/user/Dropbox/localhost/trackstar/protected/views/layouts/main.php(47): date()
#1 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(119): require()
#2 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(88): SiteController->renderInternal()
#3 /Users/user/Dropbox/localhost/yii/framework/web/widgets/CContentDecorator.php(78): SiteController->renderFile()
#4 /Users/user/Dropbox/localhost/yii/framework/web/widgets/CContentDecorator.php(56): CContentDecorator->decorate()
#5 /Users/user/Dropbox/localhost/yii/framework/web/widgets/COutputProcessor.php(45): CContentDecorator->processOutput()
#6 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(207): CContentDecorator->run()
#7 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(302): SiteController->endWidget()
#8 /Users/user/Dropbox/localhost/trackstar/protected/views/layouts/column1.php(7): SiteController->endContent()
#9 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(119): require()
#10 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(88): SiteController->renderInternal()
#11 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(689): SiteController->renderFile()
#12 /Users/user/Dropbox/localhost/trackstar/protected/controllers/SiteController.php(32): SiteController->render()
#13 /Users/user/Dropbox/localhost/yii/framework/web/actions/CInlineAction.php(32): SiteController->actionIndex()
#14 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(300): CInlineAction->run()
#15 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(278): SiteController->runAction()
#16 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(257): SiteController->runActionWithFilters()
#17 /Users/user/Dropbox/localhost/yii/framework/web/CWebApplication.php(320): SiteController->run()
#18 /Users/user/Dropbox/localhost/yii/framework/web/CWebApplication.php(120): CWebApplication->runController()
#19 /Users/user/Dropbox/localhost/yii/framework/base/CApplication.php(135): CWebApplication->processRequest()
#20 /Users/user/Dropbox/localhost/trackstar/index.php(12): CWebApplication->run()
#21 /Users/user/Dropbox/localhost/yii/framework/cli/commands/ShellCommand.php(78): require()
#22 /Users/user/Dropbox/localhost/yii/framework/console/CConsoleCommandRunner.php(62): ShellCommand->run()
#23 /Users/user/Dropbox/localhost/yii/framework/console/CConsoleApplication.php(88): CConsoleCommandRunner->run()
#24 /Users/user/Dropbox/localhost/yii/framework/base/CApplication.php(135): CConsoleApplication->processRequest()
#25 /Users/user/Dropbox/localhost/yii/framework/yiic.php(33): CConsoleApplication->run()
#26 /Users/user/Dropbox/localhost/trackstar/protected/yiic.php(7): require_once()
#27 /Users/user/Dropbox/localhost/trackstar/protected/yiic(4): require_once()
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 'Europe/Paris' for 'WEST/1.0/DST' instead in /Users/user/Dropbox/localhost/yii/framework/views/exception.php on line 71 2011-10-22 15:07:52 Yii Framework/1.1.2
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 'Europe/Paris' for 'WEST/1.0/DST' instead in /Users/user/Dropbox/localhost/yii/framework/views/log.php on line 27 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 'Europe/Paris' for 'WEST/1.0/DST' instead in /Users/user/Dropbox/localhost/yii/framework/views/log.php on line 27 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 'Europe/Paris' for 'WEST/1.0/DST' instead in /Users/user/Dropbox/localhost/yii/framework/views/log.php on line 27 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 'Europe/Paris' for 'WEST/1.0/DST' instead in /Users/user/Dropbox/localhost/yii/framework/views/log.php on line 27 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 'Europe/Paris' for 'WEST/1.0/DST' instead in /Users/user/Dropbox/localhost/yii/framework/views/log.php on line 27 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 'Europe/Paris' for 'WEST/1.0/DST' instead in /Users/user/Dropbox/localhost/yii/framework/views/log.php on line 27 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 'Europe/Paris' for 'WEST/1.0/DST' instead in /Users/user/Dropbox/localhost/yii/framework/views/log.php on line 27
Application Log
Timestamp Level Category Message
15:07:52.612484 trace system.CModule
Loading "log" application component
15:07:52.615725 trace system.CModule
Loading "request" application component
15:07:52.632834 trace system.CModule
Loading "urlManager" application component
15:07:52.683854 trace system.CModule
Loading "user" application component
15:07:52.686465 trace system.CModule
Loading "session" application component
15:07:52.704266 error php
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 'Europe/Paris' for 'WEST/1.0/DST' instead
(/Users/user/Dropbox/localhost/trackstar/protected/views/layouts/main.php:47)
Stack trace:
#0 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(88):
SiteController->renderInternal()
#1
/Users/user/Dropbox/localhost/yii/framework/web/widgets/CContentDecorator.php(78):
SiteController->renderFile()
#2
/Users/user/Dropbox/localhost/yii/framework/web/widgets/CContentDecorator.php(56):
CContentDecorator->decorate()
#3
/Users/user/Dropbox/localhost/yii/framework/web/widgets/COutputProcessor.php(45):
CContentDecorator->processOutput()
#4
/Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(207):
CContentDecorator->run()
#5
/Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(302):
SiteController->endWidget()
#6
/Users/user/Dropbox/localhost/trackstar/protected/views/layouts/column1.php(7):
SiteController->endContent()
#7
/Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(119):
require()
#8 /Users/user/Dropbox/localhost/yii/framework/web/CBaseController.php(88):
SiteController->renderInternal()
#9 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(689):
SiteController->renderFile()
#10
/Users/user/Dropbox/localhost/trackstar/protected/controllers/SiteController.php(32):
SiteController->render()
#11
/Users/user/Dropbox/localhost/yii/framework/web/actions/CInlineAction.php(32):
SiteController->actionIndex()
#12 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(300):
CInlineAction->run()
#13 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(278):
SiteController->runAction()
#14 /Users/user/Dropbox/localhost/yii/framework/web/CController.php(257):
SiteController->runActionWithFilters()
#15
/Users/user/Dropbox/localhost/yii/framework/web/CWebApplication.php(320):
SiteController->run()
#16
/Users/user/Dropbox/localhost/yii/framework/web/CWebApplication.php(120):
CWebApplication->runController()
#17 /Users/user/Dropbox/localhost/yii/framework/base/CApplication.php(135):
CWebApplication->processRequest()
#18 /Users/user/Dropbox/localhost/trackstar/index.php(12):
CWebApplication->run()
#19
/Users/user/Dropbox/localhost/yii/framework/cli/commands/ShellCommand.php(78):
require()
#20
/Users/user/Dropbox/localhost/yii/framework/console/CConsoleCommandRunner.php(62):
ShellCommand->run()
#21
/Users/user/Dropbox/localhost/yii/framework/console/CConsoleApplication.php(88):
CConsoleCommandRunner->run()
#22 /Users/user/Dropbox/localhost/yii/framework/base/CApplication.php(135):
CConsoleApplication->processRequest()
#23 /Users/user/Dropbox/localhost/yii/framework/yiic.php(33):
CConsoleApplication->run()
#24 /Users/user/Dropbox/localhost/trackstar/protected/yiic.php(7):
require_once()
#25 /Users/user/Dropbox/localhost/trackstar/protected/yiic(4):
require_once()
REQUEST_URI=/index.php
15:07:52.704550 trace system.CModule
Loading "errorHandler" application component
I tried commenting out that particular data() call on line 46 but I got another error in the framework.
How do I change my server settings to give Yii what it wants or change my app to get the correct timezone.
update:
I seem to have fixed this by changing the code to:
<div id="footer">
<?php date_default_timezone_set("Europe/Lisbon"); ?>
Copyright © <?php echo date('Y'); ?> by My Company.<br/>
All Rights Reserved.<br/>
<?php echo Yii::powered(); ?>
</div><!-- footer -->
But I would still like to know why this is happening or if this a Yii/MAMP bug of some sort.