| « Maximum Security for Wordpress |
PHP has a size limit that controls how large of a file you can upload. Many people wind up bumping into that limit when the attempt to upload large files. For example, big images, long audio files, or large video files. When you try to exceed the limit PHP will generate an error.
Sometimes there’s nothing you can do about that because of restrictions imposed by your hosting company. But, sometimes you can get around that problem with a little help. What needs to be done is to raise PHP’s max_upload_size value. But since you might not have access to the PHP configuration on your server how can you raise that limit?
There are two possible answers. First the hard way: If your hosting company allows it, install a customizable copy of PHP and adjust the settings in the php.ini file as you see fit. Of course doing that requires a lot of expertise. The majority of people don’t want to bother with doing that.
[drain file 1 show drain-hole-template] Now for the easy way: Use program code to adjust PHP settings. In many cases this works, but in some cases it doesn’t because some hosting company prohibit program code from changing PHP settings. But it’s worth a try! Download the PHP Settings plugin that we created, install it into your Wordpress site’s plugins directory, then activate the plugin. Or if you’re a techy, copy the PHP code shown near the end of this post into a file and upload to your site and activate the plugin.
What the code does it is make three adjustments. The firsts one changes the maximum file upload size allowed to 100MB, the second one changes the maximum size of POST fields values (for forms that might contain a lot of data) to 105MB, and the last one sets the maximum script execution time to 5 minutes (300 seconds) for situations where your site might have to do a lot of work before a script finishes. Those latter two changes probably aren’t necessary for most sites, but there they are just in case you need them. |
<?php
/**
Plugin Name: Fix PHP Max Upload Settings
Plugin URI: http://simplercomputing.net
Description: Attempts to set the max upload size in the server's PHP configuration.
Version: 1.0
Author: Mark - SimplerComputing.net
Author URI: http://simplercomputing.net
*/
/**
Release under GPL 2.0 - http://www.gnu.org/licenses/gpl-2.0.html
*/
@ini_set( 'upload_max_size' , '100M' );
@ini_set( 'post_max_size', '105M');
@ini_set( 'max_execution_time', '300' );
?>
So there you have it. We hope it helps solve any large file upload problems you might have with Wordpress on your particular server.
You must be logged in to post a comment.
[...] Going Beyond PHP’s Max Upload Size | Simpler Computing [...]