27 กุมภาพันธ์ 2555

ตั้งค่าการอัพโหลดไฟล์ใหญ่ๆ ใน php.ini



webserver settings:
connection timeout = 1800

php.ini settings:
max_execution_time = 1800 
memory_limit = 50M 
post_max_size = 50M 
file_uploads = On 
upload_tmp_dir = c:\php\upload_temp 
upload_max_filesize = 50M

How to Upload Large Files in PHP

php_value upload_max_filesize 10M
php_value post_max_size 10M
php_value max_input_time 300
php_value max_execution_time 300

ini_set('upload_max_filesize', '10M');
ini_set('post_max_size', '10M');
ini_set('max_input_time', 300);
ini_set('max_execution_time', 300);

PHP also provides a set_time_limit() function so you don’t need to set max_execution_time directly.
Setting the options in your PHP code is possibly more practical, since you can extend the execution time and increase the file size when your application is expecting a large upload. Other forms would revert to the default 30-second time-out and 2MB limit.


เครื่องมือ php
http://blog.limedomains.com/2010/06/02/15-useful-php-tools/

ไม่มีความคิดเห็น: