Fixing upload_max_filesize In php.ini

I was working on a local installation and needed to import all the posts/pages/everything from a current WordPress installation, so I exported the XML file. “But John,” you yell, “why didn’t you just export the database and use that?” Thank you friend for asking the obvious question. Looking back I have no idea. I don’t remember and if I recall correctly it never even crossed my mind.

SQL Tables

Instead, I decided to upload a beast of an XML file roughly 6MB. You can stop rolling your eyes at me…I feel it. Anyway, I kept getting an error saying upload_max_filesize in php.ini was blocking my file like a fat guy at the bank because of a 2MB limit.

So I needed to find my php.ini file to make the change. How did I find it? by using <php phpinfo(); > and looking at the location of the php.ini file. If you weren’t aware, phpinfo() gives you all the information about the version of PHP you are running. This is also useful if you have a client that doesn’t know anything about their host. You can run phpinfo() and find out that they are still running PHP 3.4 from yesteryear. An upgrade of PHP will allow you to use new frameworks and current versions of WordPress.

Back to finding the php.ini file. If you are using Windows and XAMPP, your php.ini file is in the PHP directory of XAMPP, so xampp/php/php.ini is the path. If you are on a Mac, “select phpInfo on your start screen of MAMP to see which version is running on your machine” (pulled from here). If you are working with a live server you’ll have to check with your hosting provider on how to upgrade php.ini. It may be easy or it may be tucked away. Each will be different.

Once you know which php.ini file is going to be updated, open it in your favorite text editor (I prefer Sublime Text 2) and find the part that says “upload_max_filesize.” Most likely it will have 2M or 4M set. You can make this as high as you want, so I set it to 40M. Save your file and refresh. Nothing…nothing changed on your phpinfo page.

This is the easiest part of the whole repair. Restart Apache. Now, check it again. Fixed? Hooray! If not, you have bigger issues and I can’t help. I will however list the resources where I was able to come up with my solution.

php-ini

Stack Overflow
DreamHost discussion
PHP Upload Configuration

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
larirawrr
larirawrr
7 years ago

Recently I was REALLY low on money and debts were eating me from all sides! That was UNTIL I decided to make money on the internet! I went to surveymoneymaker dot net, and started filling in surveys for cash, and surely I’ve been far more able to pay my bills! I’m so glad, I did this!! With all the financial stress these years, I really hope all of you will give it a chance. – 6xy1

John Hartley is a Director of Product Engineering at Beam Dental in Columbus, OH. With 5+ years of leadership experience he has worked in startups, agencies, and began his career as a freelance Front End Developer. Always looking to iterate, this blog is a place for him to share his knowledge as well as hone his craft, challenge assumptions, and build a strong base of leadership and management knowledge. Connect with him on LinkedIn

1
0
Would love your thoughts, please comment.x
()
x