Yii Framework Forum: Can't get past page 23! - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Can't get past page 23! no one else is complaining but the book seems FUBAR

#1 User is offline   zamzmith 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 22-December 10

Posted 24 December 2010 - 08:20 AM

OS X 10.6
Webroot = a MAMP VirtualHost named "WEB" /Users/xam/2-SERVIECS/WEB
Yii installation = WEB/YiiRoot1.1.2

AWAD book on top of page 23:
%cd /Webroot/demo

and then
%YiiRoot/framework/yiic shell

So I:

xam$ cd /Users/xam/2-SERVIECS/WEB/demo


xam$ YiiRoot1.1.2/framework/yiic shell
-bash: YiiRoot1.1.2/framework/yiic: No such file or directory

xam$ cd ..
xam$ YiiRoot1.1.2/framework/yiic shell

Error: index.php does not exist or is not an entry script file.

USAGE
yiic shell [entry-script | config-file]

...

xam$ YiiRoot1.1.2/framework/yiic shell demo/index.php
<!DOCTYPE
...
<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
...

Here's the complete error from an earlier try:
http://www.1n1is11.com/blog/?p=14

So I've read through to page 22 a dozen times and searched the forum for anyone else posting about this with no result and I'm dead in the water.

Thanks for any help and happy holidays.
0

#2 User is offline   jefftulsa 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 168
  • Joined: 06-October 08
  • Location:Austin, TX

Posted 28 December 2010 - 12:40 AM

Just so I am clear, you were able to use the yiic console "webapp" command to create a new application (pages 19, 20, & 21), but you are unable to run the shell command from within that newly created application? Or are you unable to create the new application as well using the console command?
0

#3 User is offline   zamzmith 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 22-December 10

Posted 28 December 2010 - 07:49 AM

I did successfully run YiiRoot/framework/yiic webapp demo

And the command webapp still works creating fully functional Yii applications.

thanks
0

#4 User is offline   jefftulsa 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 168
  • Joined: 06-October 08
  • Location:Austin, TX

Posted 28 December 2010 - 09:43 AM

So you have:

your Webroot is /Users/xam/2-SERVIECS/WEB
your YiiRoot is /Users/xam/2-SERVIECS/WEB/YiiRoot1.1.2

and you have a new web application, created using the yiic tool under

/Users/xam/2-SERVIECS/WEB/demo


But your framework is not under this directory, is is one above, correct?

So, if you cd into the application root:

xam$ cd /Users/xam/2-SERVIECS/WEB/demo


you will need to execute (with the leading ../)

xam$ ../YiiRoot1.1.2/framework/yiic shell 


or otherwise just use the full path

xam$ /Users/xam/2-SERVIECS/WEB/YiiRoot1.1.2/framework/yiic shell


but don't
cd..
back up a directory prior to executing the command, because the shell command will still be looking for the application context, which is under your demo/ folder.
0

#5 User is offline   zamzmith 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 22-December 10

Posted 28 December 2010 - 10:33 AM

I tried really hard to follow your instructions but it spewed the same raw html instead of entering the yii shell.
It's all summarized below but difficult to read. Let me try to outline here:

## Unpack the tar file and name it YiiRoot2
xam$ tar xvf yii-1.1.5.r2654.tar
xam$ mv yii-1.1.5.r2654 YiiRoot2


## Run 'webapp' creating demo2
xam$ YiiRoot2/framework/yiic webapp demo2

## change to demo2 directory
xam$ cd demo2

## Attempt to login to yii shell
xam$ ../YiiRoot2/framework/yiic shell

## pukes what I think must be some generated HTML for error reporting as if it thinks I'm in a browser? Same as before.
<!DOCTYPE html PUBLIC
...
#0 /Users/xam/2-SERVIECS/WEB/demo2/protected/views/layouts/main.php(47): date()
...


Summary:
xam$ tar xvf yii-1.1.5.r2654.tar
...

xam$ l
total 46616
drwxr-xr-x 9 xam staff 306 Nov 14 12:57 YiiRoot/
drwxr-xr-x 9 xam staff 306 Dec 28 07:01 demo/
drwxr-xr-x 12 xam staff 408 Dec 24 09:52 testdrive/
drwxr-xr-x 9 xam staff 306 Nov 14 12:57 yii-1.1.5.r2654/
-rw-r--r-- 1 xam staff 12191744 Dec 28 07:08 yii-1.1.5.r2654.tar
xam$ mv yii-1.1.5.r2654 YiiRoot2
xam$ l

total 46616
drwxr-xr-x 9 xam staff 306 Nov 14 12:57 YiiRoot/
drwxr-xr-x 9 xam staff 306 Nov 14 12:57 YiiRoot2/
drwxr-xr-x 9 xam staff 306 Dec 28 07:01 demo/
drwxr-xr-x 12 xam staff 408 Dec 24 09:52 testdrive/
-rw-r--r-- 1 xam staff 12191744 Dec 28 07:08 yii-1.1.5.r2654.tar
xam$ YiiRoot2/framework/yiic webapp demo2
Create a Web application under '/Users/xam/2-SERVIECS/WEB/demo2'? [Yes|No] yes
...
Your application has been created successfully under /Users/xam/2-SERVIECS/WEB/demo2.
b]xam$ cd demo2
[xam$ ../YiiRoot2/framework/yiic shell
[/b]<!DOCTYPE html PUBLIC
...
#0 /Users/xam/2-SERVIECS/WEB/demo2/protected/views/layouts/main.php(47): date()
#1 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/CBaseController.php(119): require()
#2 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/CBaseController.php(88): SiteController-&gt;renderInternal()
#3 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/widgets/CContentDecorator.php(78): SiteController-&gt;renderFile()
#4 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/widgets/CContentDecorator.php(56): CContentDecorator-&gt;decorate()
#5 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/widgets/COutputProcessor.php(45): CContentDecorator-&gt;processOutput()
#6 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/CBaseController.php(199): CContentDecorator-&gt;run()
#7 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/CBaseController.php(294): SiteController-&gt;endWidget()
#8 /Users/xam/2-SERVIECS/WEB/demo2/protected/views/layouts/column1.php(7): SiteController-&gt;endContent()
#9 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/CBaseController.php(119): require()
#10 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/CBaseController.php(88): SiteController-&gt;renderInternal()
#11 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/CController.php(748): SiteController-&gt;renderFile()
#12 /Users/xam/2-SERVIECS/WEB/demo2/protected/controllers/SiteController.php(32): SiteController-&gt;render()
#13 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/actions/CInlineAction.php(57): SiteController-&gt;actionIndex()
#14 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/CController.php(300): CInlineAction-&gt;run()
#15 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/CController.php(278): SiteController-&gt;runAction()
#16 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/CController.php(257): SiteController-&gt;runActionWithFilters()
#17 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/CWebApplication.php(324): SiteController-&gt;run()
#18 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/web/CWebApplication.php(121): CWebApplication-&gt;runController()
#19 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/base/CApplication.php(135): CWebApplication-&gt;processRequest()
#20 /Users/xam/2-SERVIECS/WEB/demo2/index.php(13): CWebApplication-&gt;run()
#21 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/cli/commands/ShellCommand.php(78): require()
#22 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/console/CConsoleCommandRunner.php(62): ShellCommand-&gt;run()
#23 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/console/CConsoleApplication.php(88): CConsoleCommandRunner-&gt;run()
#24 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/base/CApplication.php(135): CConsoleApplication-&gt;processRequest()
#25 /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/yiic.php(33): CConsoleApplication-&gt;run()
#26 /Users/xam/2-SERVIECS/WEB/YiiRoot2/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 'PST/-8.0/no DST' instead in /Users/xam/2-SERVIECS/WEB/YiiRoot2/framework/views/exception.php on line 71
2010-12-28 07:11:40 <a href="http://www.yiiframework.com/">Yii Framework</a>/1.1.5</div>
</body>xam$
0

#6 User is offline   jefftulsa 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 168
  • Joined: 06-October 08
  • Location:Austin, TX

Posted 29 December 2010 - 01:16 PM

Maybe you can try something a little different, just to see if it works or not? Try the yiic console tool file located under the protected directory.

Go ahead and cd into the protected directory of where your demo application is located

$> cd /Users/xam/2-SERVIECS/WEB/demo/protected/

and try to run

$> ./yiic shell config/main.php

or explicitly use the php command

$> php ./yiic shell config/main.php

Maybe this will give you different results that may (or may not) be helpful.
0

#7 User is offline   jefftulsa 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 168
  • Joined: 06-October 08
  • Location:Austin, TX

Posted 29 December 2010 - 01:32 PM

Also, if this really is the result of your configuration not liking the use of

date('Y')


without an explicit reference to timezone in the standard footer of the main layout file, you may also want to either

1) set a timezone in your php.ini file
2) Adjust the code that uses the date function in the protected/views/layouts/main.php file (around line 50 or so)
3) consider relaxing the strictness of the error reporting as you work through these examples.
0

#8 User is offline   zamzmith 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 22-December 10

Posted 29 December 2010 - 08:59 PM

When I saw the line in your reply, "$> php ./yiic shell config/main.php" it dawned on me, "Which php." Indeed:

xam$ which php
/usr/bin/php

The php that comes with the OS. I'm using MAMP.

So adding "/Applications/MAMP/bin/php5.2/bin" IN FRONT of $PATH fixed yiic:
xam$ pwd
/Users/xam/2-SERVIECS/WEB/demo
xam$ ../YiiRoot/framework/yiic shell
Yii Interactive Tool v1.1 (based on Yii v1.1.5)
Please type 'help' for help. Type 'exit' to quit.
>>


BUT why doesn't /usr/bin/php work?

xam$ /usr/bin/php -v
PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:55)
Copyright © 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright © 1998-2010 Zend Technologies

OS X 10.6.5

The MAMP version is 5.2.13.

AND why didn't anyone else have this problem?

THANKS for all the help

Of course I still haven't tried the Yii shell commands.
0

#9 User is offline   andrew1 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 09-May 12

Posted 09 May 2012 - 02:28 AM

A year and a half late but thought I would add that this post applied to me and resolved my issue just now also. Identical MAC, MAMP, and adding in the above directory to the PATH now appears to have yiic shell operating
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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