Chinaunix首页 | 论坛 | 博客
  • 博客访问: 442403
  • 博文数量: 112
  • 博客积分: 4451
  • 博客等级: 上校
  • 技术积分: 1063
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-23 10:19
个人简介

更多精品http://shop65927331.taobao.com

文章分类

全部博文(112)

文章存档

2011年(19)

2010年(54)

2009年(39)

分类:

2010-02-12 11:55:32

问题:如何通过PHP脚本来控制每个脚本的执行时间及上传文件的大小?
How do I control and put limits on php scripts such as maximum execution time of each script and upload file size?

PHP supports the following resource limits directives in php.ini file:
  1. max_execution_time : Maximum execution time of each script, in seconds.
  2. max_input_time : Maximum amount of time each script may spend parsing request data.
  3. memory_limit : Maximum amount of memory a script may consume.

Edit php.ini, enter:
# vi /etc/php.ini
Set up values as follows:

max_execution_time =  30
max_input_time = 30
memory_limit = 40M

Set maximum size of POST data that PHP will accept:

post_max_size = 8M

Set maximum allowed size for uploaded files:

upload_max_filesize = 2M

Turn on or off HTTP file uploads (disallow uploading unless necessary):

file_uploads = Off

Make sure PHP redirects appropriately with the following:

cgi.force_redirect = 0

Disable file requests as fopen calls with the following

allow_url_fopen = Off

Turn on SQL safe mode:

sql.safe_mode = O

web server:
# service httpd reload

 

原文出处:

转载有理,分享无罪

阅读(894) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~