I would like to move yii framework folder outside

2019-07-20 21:29发布

I am about to start using Yii framework for some small php projects (I am used to using the code igniter framework previously).

I want to know two things: a) Is it possible to move the /framework folder outside of the web root on linux (centOS in particular) for example: /var/framework_here

b) Could you point me to resources or articles about this and how to actually carry out the task?

I've moved the framework DIR outside of public_html (outside my web root) and tried modifying the paths in the demo projects but they don't function - so I guess I'm doing it wrong.

So far i've only been able to find info on sending the 'protected' directory within a yii project outside normal web access.

Perhaps I've mis-understood, but I thought doing what i want to do would greatly improve system security - that is actually the main reason i want to do this so again I'm open to suggestions/comments.

Thanks

2条回答
再贱就再见
2楼-- · 2019-07-20 21:49

You should modify index.php in each demo project. Find line

$yii=dirname(__FILE__).'/../../framework/yii.php';

And change it to something like

$yii='/Absolute path to framework folder/yii.php';
查看更多
闹够了就滚
3楼-- · 2019-07-20 21:56

You don't need to move it out. All you need to do is put a .htaccess file inside the folder of the framework with the following content:

# Access denied folder
Order Deny,Allow
Deny from all

Doing so you disable the access the folder to anyone outside the server.

For more informations you can give a look here: https://www.google.it/search?q=htaccess+tutorial

查看更多
登录 后发表回答