How to increase Maximum File Size Upload limit in Wordpress?

Advanced feature discussion, beta programs and unsupported "Labs" features.
10 posts Page 1 of 1
by dwhittaker » Thu Nov 29, 2018 1:34 pm
I'm having a bitch of a time migrating my test site to my clients root directory. I've tried numerous plugins but either they don't work, ask for $$ or the latest one won't work because my Maximum File Size Upload limit in Wordpress is set to only 50mb.

In order for this latest migration tool to work it has to upload the entire site to a temp file which is about 130mb. All I need to do to get it to work is increase the Max File Size limit in Wordpress and can't figure out how to do that.

Anyone have any suggestions? All the answers I find on the internet point to inserting the following code into either the themes Functions file or wp-config.php:

@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

But this isn't working either... unless I'm not putting it in those files in the correct way.
by scott » Thu Nov 29, 2018 2:10 pm
dwhittaker wrote:I'm having a bitch of a time migrating my test site to my clients root directory. I've tried numerous plugins but either they don't work, ask for $$ or the latest one won't work because my Maximum File Size Upload limit in Wordpress is set to only 50mb.

In order for this latest migration tool to work it has to upload the entire site to a temp file which is about 130mb. All I need to do to get it to work is increase the Max File Size limit in Wordpress and can't figure out how to do that.

Anyone have any suggestions? All the answers I find on the internet point to inserting the following code into either the themes Functions file or wp-config.php:

@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

But this isn't working either... unless I'm not putting it in those files in the correct way.
I'm not much of a php guy, but I think you would want to do this:

@ini_set('upload_max_filesize','150M');

If that doesn't work, it may be necessary to set it system-wide.

-Scott
by drew.phillips » Thu Nov 29, 2018 3:00 pm
The post_max_size and upload_max_filesize directives are not changeable within a PHP script. They are changeable "PHP_INI_PERDIR" which means that only httpd.conf, php.ini, or .user.ini can change them.

Create a file called ".user.ini" in the site's root with the following contents:

Code: Select all

post_max_size = 250M
upload_max_filesize = 250M
That should override the 50M limits we have set.

Also, if all you are trying to do is move a Wordpress site from a directory in one Sonic hosting account, to another directory in the same account, there's a much easier way.

Using an FTP/SFTP client, copy the entire Wordpress tree from the test directory to the root directory. Then edit wp-config.php and change WP_SITEURL to the new URL. This is all that it takes to move the site if the database settings are not changing.
Drew Phillips
Programmer / System Operations, Sonic.net
by dwhittaker » Thu Nov 29, 2018 3:14 pm
Hey Drew,

1) In the meantime I found a plugin that easily increased my max file size so that's fixed

2) So I just copy the entire WP installation from my test site which is at www.bethcoreytaylor.com/test_site and just copy it to www.bethcoreytaylor.com, then edit wp-config.php? That seems almost too easy and I'm wondering why I haven't stumbled upon that method in all my "Wordpress Site Migration" web searches. I may have to update the permalinks but I'll try it and report back.
by drew.phillips » Thu Nov 29, 2018 3:28 pm
Did the plugin actually work? It looks like all it does is call "ini_set" which should have no effect with post_max_size and upload_max_filesize.

In your case of migration, that's all that's needed since you're migrating it from one directory to another on the same hosting account with no database changes. Permalinks should be fine since they're based on the "Site URL" / "Blog URL" setting which is in the database or controlled by WP_SITEURL in wp-config.php.

Even if moving it to another server it's almost as easy to do by hand.

1. Create a MySQL database dump of the wordpress database
2. Zip or copy the entire wordpress directory from the old server to the new
3. Restore the MySQL dump to the new database
4. Edit wp-config.php to reflect the new database settings and URL.
Drew Phillips
Programmer / System Operations, Sonic.net
by dwhittaker » Thu Nov 29, 2018 3:59 pm
Hey Drew,

Yeah the plugin totally worked. Increased max size limit to 200mb

So I copied/moved the test site bethcoreytaylor.com/test_site to the root directory and changed wp-config.php but now when I try to load bethcoreytaylor.com I get a 403 error: "You don't have permission to access /test_site/ on this server." It's like it's still thinking the site is at bethcoreytaylor.com/test_site.

Under Settings/General it still showed the Site URL as http://bethcoreytaylor.com/test_site. So I changed that to http://bethcoreytaylor.com but now, it's still trying to pull up bethcoreytaylor.com/test_site. This time though part of the site is showing up. Not all pertinent files are being accessed because the site looks totally effed up. Page not found errors, styles missing, images missing, etc.

Any clues? I'm supposed to have this site transferred and working by tomorrow and this process is killing me.
by drew.phillips » Thu Nov 29, 2018 4:04 pm
Based on some of the HTML being generated by WordPress (and if you're able to log in to /wp-admin), it looks like the site URL is correct. (I don't get any errors loading the main URL and it appears to work mostly fine).

From the looks of some of the output, are there references to "test_site" in other plugins or posts/pages/widgets/menus that need to be updated by hand since the URL changed? It is still appearing in some places but this is most likely due to it being referenced in other content since the main WP url is correct.
Drew Phillips
Programmer / System Operations, Sonic.net
by dwhittaker » Thu Nov 29, 2018 4:14 pm
I will never fully understand how Chrome handles caching issues. I've had this happen so many times lately: I make changes to site files and even though I delete my Wordpress and browser caches and close and reopen Chrome... changes won't show or it simply won't pull updated files from the server. If I wait a bit, somehow those changes finally show up. It's almost like it takes some internal time for Chrome to reflect changes.

That happened just now. A lot of the weird stuff I was seeing disappeared, it's now correctly pulling up bethcoreytaylor.com and not bethcoreytaylor.com/test_site. Only issue seems to be it's not finding image files but my media library shows they're there. There must some internal spots that still referencing the test site.

I will go through this with a fine tooth comb and will hopefully be able to fix these final issues since everything else now seems to be working fine. If I have any other problems I can't figure out I'll reply accordingly.

Thanks a heap for the help. Hugely appreciated and you did in fact make this migration process easier despite these final glitches. And you taught me a very easy method for migration. Sweet.

Cheers!
by dwhittaker » Thu Nov 29, 2018 6:52 pm
Complete success. Everything works. Huge thanks for your help Drew. Have a great holiday season.
by drew.phillips » Thu Nov 29, 2018 8:10 pm
Hey! My pleasure to help. I'm glad everything is working. Site looks great by the way!
Drew Phillips
Programmer / System Operations, Sonic.net
10 posts Page 1 of 1

Who is online

In total there are 28 users online :: 0 registered, 0 hidden and 28 guests (based on users active over the past 5 minutes)
Most users ever online was 999 on Mon May 10, 2021 1:02 am

Users browsing this forum: No registered users and 28 guests