在codeigniter安装指南here中,它表示为了获得最佳安全性,系统和应用程序文件夹应设置在Web根目录之上。我有点喜欢这个想法所以我给了它一个镜头。
在byethost示例中,它与htdocs(我认为)
位于同一文件夹中我通过echo $ _SERVER ['DOCUMENT_ROOT']获得了服务器路径; 所以我的是这样的: /home/vol8/byethost17.com/my_username/htdocs
所以我尝试将index.php中的路径设为
$application_folder = 'home/vol8/byethost17.com/my_username/application';
$system_path = 'home/vol8/byethost17.com/my_username/system';
但它不起作用
Your system folder path does not appear to be set correctly.
Please open the following file and correct this: index.php
与应用程序文件夹相同吗?
有人可以帮我正确设置吗?
编辑:
详细说明:
主机php版本:5.3.14 Codeiniter:2.1.3 在root中写前提:rwxr-x - x
编辑2:
当我设置
$application_folder = 'home/vol8/byethost17.com/my_username/htdocs/application';
$system_path = 'home/vol8/byethost17.com/my_username/htdocs/system';
它会起作用,这意味着可能是主持人不允许这样做。
编辑3:
当我把
$system_path = dirname(__FILE__) . "/../system";
页面不会加载,甚至不会显示错误消息。
答案 0 :(得分:3)
可以通过以下方式设置位于webroot上方目录中的CodeIgniter系统和应用程序文件夹的路径:
将system
和application
文件夹移到您的webroot上方。
1.1有些托管服务提供商不允许这样做,所以要小心。
打开index.php
并更改:
$system_folder = "system";
到
// if you are using pre-php5.3
$system_folder = dirname(__FILE__) . "/../system";
// if you are using php5.3
$system_folder = __DIR__ . "/../system";
取决于CodeIgniter的版本。
3.1对于2.0之前:
$application_folder = "application";
3.2对于2.0 +
$application_folder = '../application';