By default, the maximum upload file size for PHP scripts is set to 128 megabytes. However, you may want to change these limits. For example, you can set a lower limit to prevent users from uploading large files to your site. To do this, change the upload_max_filesize and post_max_size directives.
To ensure that file uploads work correctly, the post_max_size directive should be a little larger than the upload_max_filesize. For example, the following settings demonstrate how to set a file upload limit to 20 megabytes:
upload_max_filesize = 20M post_max_size = 21M
Setting the directives
The preferred way to set php directives is using the graphical tools in the control panel.
For accounts using the cPanel control panel.
For accounts using the Plesk control panel.
Many accounts also allow the use of a custom php.ini file. For instructions to create a custom php.ini file, see this article.
- To view a complete list of php.ini directives, please visit http://www.php.net/manual/en/ini.list.php.
- For more information about the upload_max_filesize directive, please visit http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize.
- For more information about the post_max_size directive, please visit http://www.php.net/manual/en/ini.core.php#ini.post-max-size.