我有运行nginx 1.0.5 + php-cgi(PHP 5.3.6).我需要上传〜1GB文件(必须有1-5个并行上传文件).我试图通过ajax上传创建大文件的上传.一切正常,但PHP每次上传都会占用大量内存.我设置了memory_limit = 200M,但它的上传文件大小约为150MB.如果文件较大 - 上传失败.我可以设置memory_limit越来越大,但我认为这是错误的方式,因为PHP可以吃掉所有内存.我使用这个PHP代码(简化)来处理服务器端的上传:
$input = fopen('php://input', 'rb');
$file = fopen('/tmp/' . $_GET['file'] . microtime(), 'wb');
while (!feof($input)) {
fwrite($file, fread($input, 102400));
}
fclose($input);
fclose($file);
Run Code Online (Sandbox Code Playgroud)
/etc/nginx/nginx.conf:
user www-data;
worker_processes 100;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 2g;
# server_tokens off;
server_names_hash_max_size 2048;
server_names_hash_bucket_size 128;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type …Run Code Online (Sandbox Code Playgroud) 如何在jqGrid中禁用自动加载并在需要时手动加载数据?
谢谢.
如何禁用jsTree 1.0中的移动,但不禁用dnd插件?
谢谢.