Home  >  Article  >  Backend Development  >  Detailed explanation of php.ini configuration upload file for php file upload_PHP tutorial

Detailed explanation of php.ini configuration upload file for php file upload_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:15:57820browse

Many friends may not know that if we want to make PHP file upload safe and convenient, we need to configure some file upload parameters in php.ini. Let me introduce some common parameter configuration methods to you.

Modify the php.ini option. There are many tutorials on the Internet, you can search at will.

1. First use the root account to log in to the nobody account.
2. Then use the whereis php command to check the location of php.ini and modify the php.ini file.
3. Finally, restart apache and it will take effect.

The nobody account here is the account used by apache and has very low permissions.
The main thing to note here is that the configuration file you modify must be the configuration file used by nobody.
Under normal circumstances, if the configuration is modified but it does not take effect, you can consider whether there are multiple configurations on the machine.

Configure parameters related to file upload


All these parameters are configured in php.ini.

1.file_uploads
Set to On to allow file uploads via HTTP

2.upload_tmp_dir
The directory used for temporary storage when files are uploaded to the server. If not specified, the system will use the default temporary folder (my machine is /tmp).

3.upload_max_filesize
The maximum allowed upload file size, default is 2M.

4.post_max_size
The maximum value of post data that Php can receive (including the sum of all values ​​in the form) is 8M by default.

5.memory_limit
The maximum amount of memory occupied by each PHP. This value must be greater than the file size allowed to be uploaded.

6.max_execution_time
The maximum time (seconds) for each php to run, the default is 30 seconds.

7.max_input_time
The maximum time (seconds) for Php to parse POST/GET data, the default is 60 seconds.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/628728.htmlTechArticleMaybe many friends don’t know that if we want to make php file upload safe and convenient, we need to configure php.ini Regarding some file upload parameters, let me introduce to you some common...
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