WordPress – Increase Upload Limit / Maximum File Size

By default, WordPress only allows files up to 2 MB. However, if you want to upload large photos, this can become a problem. Here I show you how you can easily change the maximum file size.

There are several ways you can resolve this. The second option worked for me.

Here you go to the file “wp-config.php” in your WordPress main directory. In this file you should add the following line:

define('WP_MEMORY_LIMIT', '64M');

Now the file size should have been increased to 64 MB.

However, it didn’t work for me.

This opportunity brought me the desired success.

2.1 Create PHPInfo

First you create a new file in your web directory, through which you can read out all PHP configurations.

echo "<?php
phpinfo();
?>" >> /var/www/html/phpinfo.php

The directory /var/www/html/ you have to adjust accordingly. Delete this file later, otherwise it will give the attacker a lot of information about you!!

Now go to your homepage and open the file. To do this, enter the following in your browser: www.euredomain.de/phpinfo.php

Now you get all PHP information displayed.

2.2 Determine path of php.ini

From this line you get the path to your php.ini

Now let’s look at the current value. To do this, look for the line “upload_max_filesize”.

2.3 Edit php.ini

Now that we know the path, let’s edit the file:

nano Pfad-zur-Datei/php.ini

Here you change these two lines according to your needs:

; Maximale Dateigröße für Uploads
; Auf 64 MB setzen
upload_max_filesize = 64M

; Maximale Größe für POST Requests
post_max_size = 64M

2.4 Restart PHP service

After you have done your changes, you need to restart the PHP service:

service php7.0-fpm restart

2.5 Check results

Now use your info website to check whether everything worked. To do this, go back to: www.euredomain.de/phpinfo.php

If everything worked, please delete the PHP info file created above.

Christian During my studies I came across the topic “Linux Server”.

However, many of the guides on the internet were not particularly helpful as they were outdated.

So I decided to put instructions on the internet myself to help others who have encountered the same challenges.

If my instructions are out of date, please write me in the comments and I will try to update them.

Christian