Summary of "restrictions" that php. ini often involves

Source: Internet
Author: User
Tags form post
: This article mainly introduces the restrictions that are often touched upon by php. ini. if you are interested in PHP tutorials, please refer to them. Max_execution_time
Php maximum execution time. the default value in php. ini is 30. that is, after the page is executed for 30 s, the server will force the execution of the page to terminate.

For general pages, 30 s is enough, but for some pages that need to directly use php for a large amount of data analysis, you need to adjust the value of max_execution_time based on the page execution efficiency, of course, try to improve your algorithm to get the best page execution efficiency.
Max_input_vars
Php maximum number of submitted forms (controls). The default value in php. ini is 1000. that is, the number of controls contained in form post data cannot exceed 1000.

Is 1000 inputs not enough? Can someone fill it out? You may have such questions, but in the actual programming process, I did encounter such a problem: uploading an excel document, the PHPExcel class library is used for parsing and output to a page for confirmation. after confirmation, the data is inserted into the database as submitted. each unit of data is stored in form-input (hidden) medium, the number of inputs is 200 (rows) * 8 (columns) = 1600. the default number is exceeded. as a result, the first 125 data records are inserted into the database each time.

When I encountered this problem, I directly output the $ _ POST value on the page, and found that there are only 125 Records, which can be determined to be a problem with post transmission. I found a few similar questions on the Internet, basically focusing on php's post size limit, but in php. in ini, I found that the default value of post_max_size is 32 M, and the data size of a post form will not exceed 32 M in any case. I think the problem should not be the size limit of post. I later noticed that it may be a restriction on the control and finally found that max_input_vars is a restriction on the post control. However, the max_input_vars information cannot be found in the php. ini of the wamp assembled on my local machine. you can only add it on your own.

; Maximum input variable nesting level; http://php.net/max-input-nesting-level;max_input_nesting_level = 64max_input_vars = 5000; // Default 1000; Maximum amount of memory a script may consume (128 MB); http://php.net/memory-limitmemory_limit = 128 M


Upload_max_filesize and post_max_size
One is the maximum limit on uploading files, and the other is the maximum limit on post.

You need to use php post to upload a large file and remember to change it (maximum file value <= upload_max_filesize <= post_max_size). Otherwise, the file will fail to be uploaded or only part of the file (for example, upload)
Max_input_time
This variable limits the time for receiving data through post or get in seconds. the default value is 60, that is, 60 s.

If the running environment of the application is on the low-speed link, you can add this value to adapt to the more time required to receive data.

The above describes the "restrictions" that php. ini often involves, including some content, and hope to help those who are interested in PHP tutorials.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.