2

我即将开始在一些小型php项目中使用Yii框架(我之前习惯使用代码点火器框架)。

我想知道两件事:a)是否可以将 /framework 文件夹移到 linux(特别是 centOS)上的 web 根目录之外,例如:/var/framework_here

b)您能否指出有关此以及如何实际执行任务的资源或文章?

我已经将框架 DIR 移到 public_html 之外(在我的 web 根目录之外)并尝试修改演示项目中的路径,但它们不起作用 - 所以我想我做错了

到目前为止,我只能找到有关在正常 Web 访问之外的 yii 项目中发送“受保护”目录的信息。

也许我误解了,但我认为做我想做的事会大大提高系统安全性——这实际上是我想这样做的主要原因,所以我再次接受建议/评论。

谢谢

4

2 回答 2

3

您应该在每个演示项目中修改 index.php。找线

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

并将其更改为类似

$yii='/Absolute path to framework folder/yii.php';
于 2013-02-11T08:29:07.020 回答
1

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

于 2013-02-10T22:43:21.880 回答