To resolve the phpMyAdmin upload file size Limit configuration method

Source: Internet
Author: User
Tags php file upload php tutorial phpmyadmin

Solve phpMyAdmin How to configure the upload file size limit

phpMyAdmin Import SQL file involves phpMyAdmin upload file size limit issue, the default phpMyAdmin upload file size is 2M, if you want to phpmyadmin upload more than 2M large files, It is necessary to modify the size configuration of the phpMyAdmin upload file or to upload large files into several batches, relative to modify phpMyAdmin upload file size restrictions come a lot easier. Resolving the phpMyAdmin upload file size limit issue involves modifying the php.ini configuration file and the phpMyAdmin profile.

Modify the phpMyAdmin upload file size limit major changes in the PHP.ini profile (PHP installation file) and phpMyAdmin configuration file (config.inc.php) two steps.

  First step: Modify php.ini File Upload size configuration in configuration file

This step is consistent with the general php.ini configuration file Upload function method, you need to modify the php.ini configuration file upload_max_filesize and post_max_size two option values, the specific modification method, please refer to: When it comes to the configuration of file uploads in php.ini, I have mentioned before about the php file Upload function code example tutorial and the jquery ajaxupload implementation of the file Upload function code example Tutorial. The php file upload feature configuration mainly involves Upload_tmp_dir, upload_max_filesize, post_max_size and other options in the php.ini configuration file.

  php.ini description of the File Upload feature configuration option

Open the PHP.ini profile to find the file uploads

  File_uploads = On

HTTP file uploads are allowed by default, and this option cannot be set to OFF.

  Upload_tmp_dir =

The default is empty, this option is also easy to forget when manually configuring the PHP runtime Environment, if you do not configure this option, the file upload function will not be implemented, this option is set to file upload files temporary directory, you must give this option to assign values, such as Upload_tmp_dir = '/ LEAPSOULCN ', on behalf of the C-disk directory has a LEAPSOULCN directory, and the session configuration, if you are in the Linux environment, you must give this directory writable permissions.

  how to upload more than 8M The big file?

Uploading large files mainly involves configuring the upload_max_filesize and post_max_size two options.

PHP.ini the default file upload size in the config file for 2m,php beginners is prone to make a mistake when writing the file upload function by setting the maximum size of the upload file area, that is, the maximum number of files allowed to upload, max_file_ The value of size (hidden range) to specify the size of the upload file, in fact, people can generally bypass this value, so security, it is best to configure the Upload_max_filesize option in the php.ini configuration file, set the file upload size.

The default upload_max_filesize = 2M, that is, the file upload size is 2M, if you want to upload more than 8M files, such as 20M, you must set upload_max_filesize = 20M.

However, the light setting upload_max_filesize = 20M is not capable of uploading large files, you must modify the Post_max_size option in the php.ini configuration file, which represents the maximum byte length of data that is allowed to post, and the default is 8M. If the post data exceeds the limit, then $_post and $_files will be empty. To upload a large file, you must set the value of the option to be greater than the upload_max_filesize instruction, and I generally set the upload_max_filesize and post_max_size values equal. In addition, if memory limits are enabled, the value should be less than the value of the Memory_limit option.

  Additional Considerations for file uploads

When uploading large files, you will have a slow upload feeling, when more than a certain time, will report the script to execute more than 30 seconds of error, because in the php.ini configuration file max_execution_time configuration options in mischief, which represents the maximum allowable execution time per script (seconds), 0 Indicates no limit. You can adjust the value of the max_execution_time appropriately, and it is not recommended to set to 0.

At this point, the php.ini configuration file in the file upload options to configure the PHP tutorial is complete, through the above steps of practice and learning, combined with PHP program, file Upload function can be achieved.

  Step Two: Modify PHP implementation time and memory limit implementation phpMyAdmin upload large files function

If you want to phpMyAdmin upload large files, you also need to modify the php.ini configuration file max_execution_time (PHP page execution maximum time), Max_input_time (PHP page accepts data maximum time), Memory_ Limit (PHP page occupies the maximum memory) three configuration options, this is because phpMyAdmin upload large files, php page execution time, memory consumption will inevitably become longer and larger, it requires the PHP running environment of the coordination, light modification upload file size limit is not enough.

  Step Three: Modify phpMyAdmin configuration file

After completing the relevant configuration of the php.ini, you will also need to modify the phpMyAdmin configuration.

1. Modify the $cfg [' exectimelimit '] configuration option in the phpMyAdmin config file, the default value is 300 and need to be modified to 0, i.e. there is no time limit.

2. Modify the $memory in the Import page of the phpMyAdmin installation root directory _limit

1
2
3
4
5
6
7
8
9

$memory _limit = Trim (@ini_get (' memory_limit '));
2 MB as Default
if (Empty ($memory _limit)) {
$memory _limit = 2 * 1024 * 1024;
}
In case no memory limit we work on 10MB chunks
if ($memory _limit = =-1) {
$memory _limit = 10 * 1024 * 1024;
}

Description : preferred to read the memory configuration option in the php.ini configuration file Memory_limit, if empty the default memory size limit is 2M, if there is no limit, the memory size is limited to 10M, You can modify this code in conjunction with the relevant information in your php.ini configuration file.

At this point, after modifying the file upload configuration options in the PHP.ini configuration file and the phpMyAdmin profile, it is possible to resolve the phpMyAdmin upload file size limit, which allows the phpMyAdmin to upload large file functions.

Original link: http://my.oschina.net/miaowang/blog/338445

To resolve the phpMyAdmin upload file size Limit configuration method

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.