Jump to content
Larry Ullman's Book Forums

Directory Structure Confusion


deancameron
 Share

Recommended Posts

Hello.

 

I'm working through the most excellent The Yii Book. The app I'm working on is named myApp.

 

For development I use XAMPP on my mac and the htdocs directory contains various projects (in various states of disarray and madness), so the structure is something like:

 

XAMPP

->xampfiles

->htdocs

-myApp (the Yii Book)

-anotherApp

-someWordpressThing

-EdwardPlaysTennis

 

 

I followed the setup instructions in The Yii Book and moved the "protected" & "framework" folders outside of my htdocs folder.

 

Something seems not so right about that as now the model, view & controller and other folders associated with myApp are in the "protected" folder - external to myApp.

 

At some point, I figure I will develop another Yii application on my machine. I can't have two "protected" folders in the same folder.

 

Did I do something boneheaded (wouldn't be the first time) or does one rename the "protected" folder while developing another Yii app? Why doesn't one keep all of the associated folders inside of that App's space?

 

Thanks for the info.

 

Rock on.

Link to comment
Share on other sites

You can rename the protected folder and move it outside the webroot that would be one way of doing it for separate projects. You may also want to check this link out on the YiiFramework.com website.

 

http://www.yiiframework.com/wiki/116/moving-project-code-outside-of-webroot-plus-multiple-project-support/

 

But if you were working on a localhost as myself i don't think you really need to move the protected folder from the webroot as its safe already for working on.

Link to comment
Share on other sites

  • 3 weeks later...

Actually, I found symlinking directories very helpful while working with IDEs like PhpStorm what is my favorite due to its speed, versatility and reliability.

 

Then you can create a following structure (dots are only for formatting):

 

/-|

|

|-YiiFramework

|-YourProjectName-|

|..............................|-protected

|-web-|

|.........|-protected

 

So now you can symlink both 'protected' folders keeping your IDE happy as well as following Larry's safety guidance.

Link to comment
Share on other sites

Thank you, Larry!

 

Ffor clarification - this setup is for development only. While moved onto production server - symlinks are gone, the inner 'protected' folder is not needed any more and can be removed from production server. This way the only thing left is safe configuration with critical folders outside web root.

Link to comment
Share on other sites

 Share

×
×
  • Create New...