Search

Configure PHP memory limit, post max size and upload max filesize on WordPress

Configure PHP memory limit, post max size and upload max filesize on WordPress

Your WordPress install may have a prohibitive maximum file size for uploads and memory limit. As I was installing a theme into WordPress, this note appeared:

To increase those limits to a minimum, you may have to configure a few php files through your FTP client.

But first…which PHP version are you running?
It’s important to pay attention to the first number of your version. You will either be running a version of PHP 4 or PHP 5.

There are four settings within the PHP info 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.

max_execution_time – You may receive a message such as “Maximum execution time of 30 seconds exceeded” or “Maximum execution time of 60 seconds exceeded”. This means that it is taking to longer for a process to complete and it is timing out.

post_max_size – This defines the maximum size that is handled in a POST request. We will need to set this to our new upload limit.

upload_max_filesize – This defines the maximum size for file uploads. This will also be set to our new upload limit.

Now that we have a little bit of info about our PHP set-up, here are the TWO ways I configured it.

Method 1: For Memory Limit and Max Execution Time
You will need to edit the wp-config.php file on your WordPress site. It is located in your WordPress site’s root folder, and you will need to use an FTP client or file manager in your web hosting control panel.

Next, you need to paste this code in wp-config.php file just before the line that says ‘That’s all, stop editing! Happy blogging/posting.’

Method 2: Knock all birds with one stone – Uploading your own PHP.ini
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 for all four settings within PHP. To do so, create a new file and open it up in your text editor. Then, paste in the following code:

If you are on PHP version 4, then save this file as “php.ini”. If you are on PHP version 5, then save as “php5.ini”. If you do happen to be running version 5, and the above filename does not work for you, then you can rename it “php.ini” and upload it again.

FTP into your site again, and find the root directory where your WordPress files live. Drag this file into this directory.

Clear your browser’s cache and cookies to preview whether or not this method worked, go to Media -> Add New and check to see if your maximum file size has increased.

To be honest, there are quite a few things that you may need to try before you can increase the upload limit on your WordPress install. I definitely had to try a bunch of methods until I found the two that worked best for me. If you guys have any questions, don’t hesitate to reach out to me for help. I run most websites under my hosting server at AVIDBITS.COM and have been learning along the way in configuring settings to ensure a highly functional and optimized website.