Home  >  Article  >  Backend Development  >  Permission issues and solutions encountered when creating a directory with mkdir in Codeigniter, codeignitermkdir_PHP tutorial

Permission issues and solutions encountered when creating a directory with mkdir in Codeigniter, codeignitermkdir_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:22:151301browse

Codeigniter encountered permission problems and solutions when creating a directory with mkdir, codeignitermkdir

When I used Codeigniter to upload files today (deployed on Centos), the following error was prompted:

A problem was encountered while attempting to move the uploaded file to the final destination.

Related code:

Copy code The code is as follows:

//Directory detection
if (!is_dir($cache_path)) mkdir($cache_path, '777');

Modify it to the following code to solve the problem:

Copy code The code is as follows:

//Directory detection
if (!is_dir($cache_path)) mkdir($cache_path, 0777);

Use mkdir to create a new directory in Linux and grant permissions and find that the result is wrong

To create a new directory, just use:
mkdir /mml
To enhance security, you need to modify the owner and operation attributes of the directory:
chown -R user:dba /mml user is the user, dba For the created group
chmod -R 777 /mml
In your case, you don’t need to use it, but it is still very necessary for security. You can learn about its application on Baidu.
You only need to grant operation permissions to the new directory above
For example, chmod -R 777 /mml

Use the command mkdir user to create a directory under Linux. I created the wei directory under user but cannot switch to wei. I want to create a file under wei

Did you create wei under user? Then cd /user/wei and then you can enter. If you can't get in, it's probably a permissions issue. chmod +x wei to add execution permissions to the wei folder.
To create a file, just vi hello to create a file named hello
You can find out how to use the vi editor

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/848797.htmlTechArticleCodeigniter encountered permission problems and solutions when creating a directory with mkdir, codeignitermkdir was uploading files with Codeigniter today (deployed in Centos), the following error is prompted: A problem...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn