The PHP configuration file, php.ini, is the default configuration file for running PHP applications and it is the most immediate way to affect PHP’s functionality. The php.ini file is read each time whenever PHP was initialized. In other words, it is read whenever httpd is restarted for the module version or with each script execution for the CGI version.
The php.initialization(ini) code is used for maximizing the file size, execution time and post size. The below code should be pasted into the php.initialization(ini) file to maximize the uploading file size of the website.
Uploading your own PHP.ini
There are three settings within the PHP initialization file that are relevant to your upload limit. You can search through the file to see what they are currently set to.
- memory_limit – This defines how much memory is allocated to PHP. You will simply need to ensure that this number is as high or higher than the upload limit you want to set.
- post_max_size – This defines the maximum size that is handled in a POST request. We can set this to our new upload limit.
- upload_max_filesize – This defines the maximum size for uploading the files.It can be increased and set to our new upload limit.
If you are unable to find your php.ini file, or if your web host does not give you access to it, you may be able to upload your own file to override the default settings. To do so, create a new file as php.ini inside the wp-admin and open it up in your text editor. Then, paste the following code:
memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
file_uploads = On
max_execution_time = 300