본문 바로가기
IT

PHP php.ini 파일 업로드 설정

by 세계정보ㄱ 2011. 10. 11.
728x90
반응형

file_uploads = On
upload_max_filesize = 10M
post_max_size = 11M
memory_limit = 20M
(memory_limit > post_max_size > upload_max_filesize)

max_execution_time = 30 스크립트가 실행 가능한 최대 시간(초). 0으로 설정하면 시간 제한이 없어짐.
max_input_time = 60 파일 업로드 등의 입력 데이터 처리의 최대 시간(초).

#주의점
웹에서 업로드의 제한을 2GB에서 3GB로 수정하였더니, php페이지에서 오류가 발생.
원인은 각 설정값의 integer가 unsigned integer의 최대값을 넘으면 overflow가 발생. 

https://bugs.php.net/bug.php?id=35578
http://php.net/manual/en/ini.core.php

File Uploads

File Uploads Configuration Options
Name Default Changeable Changelog
file_uploads "1" PHP_INI_SYSTEM PHP_INI_ALL in PHP <= 4.2.3. Available since PHP 4.0.3.
upload_tmp_dir NULL PHP_INI_SYSTEM  
upload_max_filesize "2M" PHP_INI_PERDIR PHP_INI_ALL in PHP <= 4.2.3.
max_file_uploads 20 PHP_INI_SYSTEM Available since PHP 5.2.12.

Here's a short explanation of the configuration directives.

file_uploads boolean

Whether or not to allow HTTP file uploads. See also the upload_max_filesize, upload_tmp_dir, and post_max_size directives.

When an integer is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used.

max_file_uploads
integer

The maximum number of files allowed to be uploaded simultaneously. Starting with PHP 5.3.4, upload fields left blank on submission do not count towards this limit.

post_max_size integer

Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size. When an integer is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used. If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. <form action="edit.php?processed=1">, and then checking if $_GET['processed'] is set.

Note:

PHP allows shortcuts for bit values, including K (kilo), M (mega) and G (giga). PHP will do the conversions automatically if you use any of these. Be careful not to exceed the 32 bit signed integer limit (if you're using 32bit versions) as it will cause your script to fail.


 

728x90
반응형