Codeigniter -设置目录和文件权限(chmod设置)

时间:2021-05-08 16:43:11

Since i don't think i got right permissions all over my application folders and files is there anyway to check the right permissions allover them?

因为我不认为我的应用程序文件夹和文件都有正确的权限,所以要检查正确的权限吗?

I mean, does anyone knows/has a standard/tutorial/link to follow for Codeigniter to set chmod permissions?

我的意思是,有人知道/有一个标准的/教程/链接来跟随Codeigniter来设置chmod权限吗?

thanks, any help appriaciated!

谢谢,任何帮助appriaciated !

NB: when i say allover i mean from the root to all files the application & system folders contains

NB:当我说allover我是指从根到应用程序和系统文件夹包含的所有文件

Also to specify little bit, i think i got problems with permissions, cause i passed my application through different OS and for example macosx setted different permissions on directories than windows etc... so it's sort of a hell actually

还有一点,我认为我在权限问题上遇到了问题,因为我通过不同的操作系统通过了我的应用程序,比如macosx在目录上的权限不同于windows等等。所以这是一种地狱

This is my app schema:

这是我的app schema:

/project
   /application
   /system
   /css
   /img
   /vendor
   index.php
   .htaccess

1 个解决方案

#1


5  

You want to:

你想:

chmod -R 0644 application system index.php

Assuming that CI is installed in the web root, with the application/ and system/ directories residing therein, which is the default setup.

假设CI安装在web根目录中,其中包含应用程序/和系统/目录,这是默认设置。

What I typically do is put the application/ and system/ directories outside of the web root when I use Codeigniter, at which point you need to edit your index.php file to reflect that:

当我使用Codeigniter时,我通常会将应用程序/和系统/目录放在web根之外,这时您需要编辑索引。php文件反映:

$system_path = '../system';
$application_folder = '../application';

Note, you'd be adding the ../ (and also need to move those directories one level down) but I digress. The permissions for each directory should be 0755 and for each .php file 0644, wherever you end up putting them. This includes any vendor, 3rdparty, sparks, etc, and any custom asset locations.

注意,你要加上。/(也需要将这些目录向下移动一层)但我离题了。每个目录的权限应该是0755,每个.php文件的权限应该是0644,无论您将它们放在哪里。这包括任何供应商、3rdparty、sparks等,以及任何自定义资产位置。

If using a templating engine of some sort, good setups will work with 0755 folder permissions at the location where the engine writes its output and intermediate output if applicable. If you find that breaking, find a host that supports suexec so that you don't have to make those locations 777 (or world writeable).

如果使用某种模板引擎,好的设置将在引擎写入输出和中间输出的位置使用0755文件夹权限。如果你发现了故障,找到一个支持suexec的主机,这样你就不需要将这些位置设为777(或world writeable)。

This is most easily done using a terminal (SSH), but should also be easily possible with whatever file manager thingadongdong your host provides.

这是使用终端(SSH)最容易做到的,但也应该可以轻松地使用主机提供的任何文件管理器。

#1


5  

You want to:

你想:

chmod -R 0644 application system index.php

Assuming that CI is installed in the web root, with the application/ and system/ directories residing therein, which is the default setup.

假设CI安装在web根目录中,其中包含应用程序/和系统/目录,这是默认设置。

What I typically do is put the application/ and system/ directories outside of the web root when I use Codeigniter, at which point you need to edit your index.php file to reflect that:

当我使用Codeigniter时,我通常会将应用程序/和系统/目录放在web根之外,这时您需要编辑索引。php文件反映:

$system_path = '../system';
$application_folder = '../application';

Note, you'd be adding the ../ (and also need to move those directories one level down) but I digress. The permissions for each directory should be 0755 and for each .php file 0644, wherever you end up putting them. This includes any vendor, 3rdparty, sparks, etc, and any custom asset locations.

注意,你要加上。/(也需要将这些目录向下移动一层)但我离题了。每个目录的权限应该是0755,每个.php文件的权限应该是0644,无论您将它们放在哪里。这包括任何供应商、3rdparty、sparks等,以及任何自定义资产位置。

If using a templating engine of some sort, good setups will work with 0755 folder permissions at the location where the engine writes its output and intermediate output if applicable. If you find that breaking, find a host that supports suexec so that you don't have to make those locations 777 (or world writeable).

如果使用某种模板引擎,好的设置将在引擎写入输出和中间输出的位置使用0755文件夹权限。如果你发现了故障,找到一个支持suexec的主机,这样你就不需要将这些位置设为777(或world writeable)。

This is most easily done using a terminal (SSH), but should also be easily possible with whatever file manager thingadongdong your host provides.

这是使用终端(SSH)最容易做到的,但也应该可以轻松地使用主机提供的任何文件管理器。