Changing the Yii directory layout
Yii has a pre-defined convention for directory layout. It allows us to significantly lower the learning curve, but sometimes the custom directory structure fits the project better.
In this recipe, we will rename a few directories and share common libraries around separate projects.
The plan is to:
Rename
protectedtoappCreate a
shareddirectory where we can store components shared across multiple applicationsMove
runtimeout ofapp
Getting ready
Let's prepare the environment.
Get a copy of the
frameworkdirectory from the Yii website.Set up the following directory structure:
/var/www/example/framework/www/Unpack the
frameworkdirectory contents to/var/www/example/framework/.
How to do it...
Carry out the following steps:
Go to the
frameworkdirectory.Run
yiic webapp /var/www/example/www/.Go to
/var/www/example/wwwand renameprotectedtoapp.Replace all occurrences of
protectedwithappinindex.phpandindex-test.php. Check that the path to Yii is correct in...