TechDex Development & Solutions
live minder, lead generation, trend analysis, market research, internet marketing, seo, social media, keyword analysis


RSS Feed| Blog Home | Log In | View As Guest  | Archives |

Blog Search

How to Increase the WordPress Maximum Upload File Size

How to Increase the WordPress Maximum Upload File Size
Posted by Dexter Nelson: Tuesday, December 13, 2016 (1:42 PM)

How to Increase the WordPress Maximum Upload File Size


So, have you ever tried to increase the upload file size in WordPress and every solution failed?


Yeah, me too.


I started a new WP blog for a project  -- and before you ask...


No, I don't always use my CGI Blog. It was design for corporate use so it's like using a jackhammer to drive a nail.


Anyway, I create this new blog and it's going great. Then one day I found myself having to edit like every feature image because of a stupid 2M limit.


I spent about an hour trying to find a way to increase the maximum upload file size limit and nothing worked.


The code in the WP-config file? Nope.


The .htaccess file thingy? That didn't work either.


Others say edit the php.ini file, but I have a VPS (Apache) with multiple websites and to be honest?


... I REALLY don't want to change the maximum upload file size for EVERY site on my server. I just needed this one site.


Here's the thing that everyone danced around, but didn't quite say.


WordPress doesn't set your maximum upload file size - your server does.


All WordPress does is read the size from your server's php.ini file.


I found this out going through my WP files.


Don't believe me?


Check out the /wp-includes/media-template.php and the /wp-admin/includes/media.php files in your installation.


There are a few lines of code that looks like this:


 


$max_upload_size = wp_max_upload_size();
    if ( ! \$max_upload_size ) {
     $max_upload_size = 0;
    }

 



The if statement basically translates to - if there is no max_upload_size, then the default should be 0.


In other words, if your server doesn't define a max_upload_size, then you can't upload anything.


So here's what I did:


From my SSL, logged in as root.


# find / -name "*php.ini*"


This gave me the results of every php.ini file and I noted there was one in the system folder for each website.


For UNIX based systems:


/system//etc/php.ini


NOTE: varies depending on installation:
/var/www/
/var/www/hosts/
... and so on.


An example might be /var/www/hosts/system/yourdomain.com/etc/php.ini


By default PHP has a limit of 2M, but depending on your host there might be a higher limit.


I edited the php.ini file for the site that I wanted and saved it.


The line to look for is this one.
upload_max_filesize = 2M


I changed it to upload_max_filesize = 5M


Then I restarted Apache.
# /etc/init.d/httpd restart


NOTE 2: I really think this should be the go to option. Work arounds are nice, but they have a way of getting undone or become invalid with upgrades, clean ups, resets, etc.

Admin
User: Admin 
Member Since: 1/1/2009 
Number of Posts: 143 
Message Admin
--
Dexter Nelson
TechDex Development & Solutions
http://www.techdex.net

Facebook: http://www.facebook.com/dexter.nelson
Twitter: http://twitter.com/dexterwebn

Leave A Reply


Post A Comment


Most Commented Stories
  1. Windows Media Player Crashes Playing MP4 Files (Solved) (662)
  2. Saggy Pants Cost Green Day Singer His Plane Seat (183)
  3. Ounce By Ounce Gold Takes Off (166)
  4. Occupy Protesters Rally Around Wounded Iraq Vet (82)
  5. SOLVED EXE Files Wont Run Cant Run EXE Files (30)
  6. TechDex SMART Mobile Design (21)
  7. Live Minder Case Study 1 (18)
  8. TechDex DirectToDesktop direct2client technology (16)
  9. Updated How To Get Indexed in Yahoo (14)
  10. Live Minder Trend Analysis Statistics Day 4 (13)

Top 10 Stories
  1. How to Increase the WordPress Maximum Upload File Size
  2. Apple Claims Their New iPad Pro Will Replace The Laptop
  3. Secunia PSI 3.0 Stuck on Determining Which Files to Scan SOLVED
  4. How To Successfully Remove Rombertik Malware
  5. Using Dark Post Profits 2.0 To Increase Software Sales
  6. Best Free Ad Blocking Software Review
  7. Free Commercial Real Estate Service And Real Estate Script
  8. Are Earthquakes Causing Global Climate Change
  9. Understanding What Caused The Border Crisis
  10. AT&T trumps Google with first gigabit internet in Raleigh




® Live Minder © TechDex Development & Solutions.
live minder, lead generation, trend analysis, market research, internet marketing, seo, social media, keyword analysis

Powered by TechDex CGI Blog.