Jump to content
Larry Ullman's Book Forums

Newbie Question-Where Does Yii Framework Folder Go?


Recommended Posts

Larry, others -- I've been following Larry for years, learned php from his first book and bought his YII book some time ago but am just getting to trying out YII.


Do I need a copy of the YII Framework folder in the site folder for each site I am going to build with YII or can I simply run YII from a folder shared by all my sites?  


Does YII create the site folders and structures inside the Framework folder or in a separate site folder?


Obviously not quite clear on the concept even of frameworks.


In fact, this is the first time I've used any framework.  I've been programming directly in PHP now for a good decade.





Link to comment
Share on other sites

Hey Kenoli. With Yii 1, you can put the frameworks folder anywhere, such as a common, shared location. With Yii 1, your framework folder will be separate from all your site stuff. So maybe you want the Yii framework folder in your home directory, and your sites in your sites directory. Let me know if this is still unclear. 

  • Upvote 1
Link to comment
Share on other sites

Larry  -- Thanks.  I'm feeling very clueless here.


I'm using xampp to implement php on my mac.


Normally, I use CODA to write php scripts.  I set up a site in Coda with the framework file in it and tried to run yii by opening and previewing yiic.php from within Coda and it says I don't have permissions to run it.


I can't run it from the command line as the system doesn't seem to know how to run php scripts using xampp, or I guess that is why it won't run.


from within Coda there is an additional issue which is that Coda works by setting up sites and I can't really run a script that is not with in that site from within Coda.


Clueless --



Link to comment
Share on other sites

When I put framework in the XAMPP htdocs directory and try to run it from the command line I get this error:


PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20100525/newrelic.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20100525/newrelic.so, 9): image not found in Unknown on line 0
Yii command runner (based on Yii v1.1.15)
Usage: framework/yiic.php <command-name> [parameters...]

The following commands are available:
 - message
 - migrate
 - shell
 - webapp

To see individual command help, use the following:
   framework/yiic.php help <command-name>

Link to comment
Share on other sites

I'm mystified but seem to have created a site structure.  Terminal will not run yiic.  I get a "command not found" error.


According to some forum posts, this probably means there is some issue, maybe line endings or some permission issue, I could never track down.  When I include the entire path to the file, it runs with the php error indicated above. 


I guess all yiic is doing is running the yiic.php script, since I get the same thing when I run php yiic.php from the command line as indicated above.  So, abandon the yiic terminal app as unneeded.


The error message when I ran yiic.php did indicate that some commands, including webapp, were available so I tried running the webapp command pointed at the directory I wanted the file structure in.  It threw the same errors but it did create the file structure.


The mysteries of BSD, go figure...


I hope the rest of YII goes more smoothly.




PS:  I have actually avoided learning a framework or even a cms like Wordpress when creating my web sites, as It seemed to me that just learning php was enough and that a framework or Wordpress simply meant I had an additional thing to learn.  In addition, the little I looked into Wordpress (mostly trying to edit wordpress web sites others had set up), I didn't like being limited to what Wordpress thought I needed on a web site.  Using PHP directly, I could do whatever I wanted.


So, I have been writing my own CMSs for my web sites.  I even discovered that I had ferreted out the MVC structure before reading what it was.  It is kind of intuitive after all, the reason, I am sure, that it is so broadly used.


I hope YII proves worth the trouble.  Not a propitious start: two days just to create a file structure.


Guess I will read on in your book, Larry...

Link to comment
Share on other sites

Just so you know, I try to answer questions 3 days per week, so I'm not going to get to every question you post if you post multiple times in a day. It's no problem if you do, I'm just saying what to expect. It sounds like the problems here are that you're trying to do things in Coda (a text editor) that you need to do in the terminal. 


I'm also not exactly sure why you're focusing so much on the file structure here. Put your Yii framework folder anywhere that it's available, then use the `yiic.php` script to generate a new site within a web directory. The yiic script will do all the work. The only catch is properly using PHP and yiic from the command line. It's all in the book, though.


Let me know if you have any other questions or problems. 

Link to comment
Share on other sites

If your php binary is not aliased available in /usr/bin/php, you need to specify a more explicit path. If you can't run "php -v" from everywhere in your terminal, that's the case. Try running 'which php' and use that path.



$ which php



Now use that path to run yiic.

$ ls -lah

... (A lot of folders)


$ ls -lah

... see YII contents

$ /usr/bin/php yiic.php (run commands here)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...