I’m interested in installing Yii server wide so that it is available to all sites / domains on my server, rather than installing it per site.
I was wondering however, where would be the recommended best placement of the ‘framework’ directory? The sites’ directory structure are /home/account_name/public_html/. Would placing ‘framework’ in the ‘home’ directory be OK / best practice? Or would it be better to place it in /user/local/lib/php/?
Well depnding if it will be used by one or all users in system.
If you want all users to use same yii installation, you can place in the location like Ben suggested.
If you want to be used only by one user but for multiple sites/domains, place it somewhere in your home folder.
And I usually copy yii files into yii_1.1.8 folder for example, and then I make soft link to this location. If in future, I decide to upgrade Yii version, just create folder with new Yii version, and change soft link path. This way you do not need to change and project/site related files!
Yes, suggested solution will prevent access to yii framework files. You can place your yii framework files anywhere on system, for example like one of users suggested: /usr/share/php/yii, or just one level up of your web root folder(I am using this for my dev machine).
Your application folder must be visible, however, if you want more security, you can place your ‘protected’ folder outside web root too, which is also good practice.
If you are using and SCM software(which I greatly recommend), you don’t need to have three versions of application, like it is suggested on wiki article above.
A word of advice: Unless you are installing Yii via a packaging tool such as apt/dpkg or yum/rpm, you might be better off placing the Yii framework files in /usr/local/share instead of /usr/share or even /var/www.