How to increase the limits on the size of uploaded files and the amount of memory allocated for PHP. How to increase the file upload limit in WordPress How to increase the size of file uploads in WordPress

Proper optimization of a computer allows it to quickly cope with assigned tasks, even with not the most powerful hardware.

One of the most important optimization points when you have a small amount of RAM is choosing the optimal size of the Windows paging file.

Most users leave it up to Windows to choose the size of the page file to keep their computer running perfectly. This approach is fundamentally wrong, and setting up the paging file yourself will increase system performance.

VIDEO: What should be the SIZE of the Windows SWAP FILE?

What is the Windows page file and why is it needed?

Every computer has RAM installed, the purpose of which is to temporarily store data for quick access by the processor. A hard drive can also act as storage for quick access to data, but its speed is significantly lower than that of RAM.

Exactly called a swap file An area of ​​the hard drive dedicated to temporary storage of information. When free RAM runs out, the computer will write information to the paging file, and then can read it from there.

If we look at the work of the paging file using the example, the following scenario can be noted. When running several applications that actively consume RAM, some of them will be inactive (minimized). In such a situation, there is no point in storing them in RAM, thereby loading free space, and the Windows operating system will transfer inactive programs to the page file. Active programs will be in RAM in order to be processed faster.

When the user accesses a previously inactive program, its data will be moved from the page file to RAM, and some information from RAM will be sent to the page file.

If your computer does not have enough RAM to store data and the page file is not enabled or configured incorrectly, applications may crash or "blue screens of death" when trying to run a productive program.

If we take the average figures for the paging file size for computers, we can name the following values:

  • 1 GB 2048-2048 MB;
  • 2 GB RAM: swap file – 1512-1512 MB;
  • 4 GB RAM: swap file – 1024-1024 MB;
  • 8 GB RAM and more: no swap file needed.

How to increase or decrease the page file?

The paging file settings can be made on any version of the Windows operating system.

To do this, you need to go to the virtual memory settings menu:

  1. Type the phrase in the windows search bar "Control Panel" and go into it;
  2. Next, set the viewing mode to "Large icons" and click on the item "System";
  3. After that, select on the left side of the settings menu that opens;
  4. Another menu will open, in which on the tab "Additionally" you need to select an item "Options" in the subtitle "Performance";
  5. Next you will see the virtual memory settings menu. Here, to set the value of the paging file yourself, you need to uncheck the item "Automatically select paging file size". After this, the settings will become available. According to the recommendations noted earlier in the article, set the page file size.

Important: If you have multiple hard drives installed on your computer, it is recommended that you create the paging file on something other than system media. An exception to this rule can only be if the system drive is a solid-state drive (SSD) with high operating speeds compared to other computer hard drives.

You will need to restart your computer for changes you make to the paging file size to take effect.

Well, that's all for today! Please write in the comments whether you were able to choose the optimal value for the Windows paging file?

And also don't forget subscribe to my YouTube channel and notifications by clicking on the bell next to the subscribe button on my channel!

By default, WordPress has a limit on the size of uploaded files, which depends on the server settings.

This limitation exists to ensure the security and performance of the site. It prevents users from overloading your site by downloading large files and crashing the server.

If you have a large site with heavy content, you may need to increase the maximum file upload size.

You might receive an error like this:

The uploaded file exceeds the upload_max_filesize directive in php.ini

In this article, you will learn how to increase the maximum file upload size in WordPress in three ways:

How to find out the maximum file size for uploading in WordPress

The media downloader uses PHP to download files and has server restrictions on the maximum size of downloaded files. WordPress automatically shows this size in the Media Gallery:

WordPress - Media - Library

WordPress - Media - Add New

Increasing the maximum upload file size in functions.php

In some cases this method may work, in others it may not. Try adding this code to the file active topic:

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

Increasing the maximum size of uploaded files in php.ini

Using a file manager on your hosting or via an FTP client, go to the root folder of your site and find the file php.ini. This file does not exist in the standard WordPress installation; if you don’t have it, create it and add the following entry to it:

upload_max_filesize = 100M
post_max_size = 200M
memory_limit = 256M
file_uploads = On
max_execution_time = 300

upload_max_filesize = 100M— The maximum upload file size is 100 MB.
post_max_size = 200M— Maximum post size.
memory_limit = 256M- which WordPress can use to work with plugins and scripts. If you've edited this setting before, keep it in just one place.

Change 100M, 200M And 256M to the values ​​you need. Make parameters 1 - 3 increase from smallest to largest, that is, the value upload_max_filesize should be smaller than others post_max_size- average, and memory_limit- the biggest.

Meaning max_execution_time = 300 means the amount of time in seconds that can be spent loading one script.

Clear cache, check changes.

If this method doesn't work, try renaming the file php.ini V php5.ini.

Increasing the maximum size of uploaded files in .htaccess

If it was not possible to change restrictions through the file php.ini, try editing the file .htaccess.

This file is located in the site's root folder, but may not be visible. Check your file manager or FTP client settings. Add these lines at the very end .htaccess:

php_value upload_max_filesize 100M
php_value post_max_size 200M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 180

You can edit this file in the same way as the file php.ini.

Change the limits to values ​​that suit you.
Save changes, upload to server, update cache.

Hosting panel

If you were unable to increase the limit on the size of uploaded files using any of these methods, try going to your hosting and finding the necessary settings. There may be a section in your hosting control panel where you can change these settings.

If none of these methods help, contact technical support for help, this is a simple question, they can help increase the maximum size of downloaded files.

If you need to upload a large file or files only once, for security reasons you can upload them via FTP without changing the maximum size limit.

Typically files uploaded via FTP to a folder /wp-content/uploads/ are not displayed in the media library in the WP admin, but you can install the Media from FTP plugin, which will show files uploaded via FTP in the WP library. This plugin is updated regularly and supports regular and multisite WordPress installations.

If you're experiencing that WordPress won't allow you to upload a file larger than the maximum size allowed, don't worry. There are several ways to increase the maximum upload size in WordPress.

The maximum file size in WordPress can be set at different levels - at the WordPress configuration level, at the PHP interpreter configuration level, and even at the web server level.

The upload_max_filesize directive in php.ini

In the php.ini configuration file, using the upload_max_filesize directive, the maximum size of files uploaded to the server is set. If you have access to the php.ini file on your hosting site, you can change this value:

Upload_max_filesize = 20M

Please note that PHP also sets the maximum size of POST requests using the post_max_size directive, which must be greater than or equal to the maximum size of uploaded files:

Post_max_size = 20M

Depending on the server configuration, the new values ​​may take effect immediately after the changes are made, or you may need to restart the web server or PHP interpreter.

PHP directives via .htaccess

If you don't have access to a PHP configuration file, you can try setting the values ​​using the Apache web server's .htaccess file. If you are working with Apache, then there is probably already a .htaccess file in the root directory of your WordPress site, to which you can add the following values:

Php_value upload_max_filesize 20M php_value post_max_size 20M

Changes to .htaccess files usually take effect immediately after saving.

PHP directives via nginx.conf

For the nginx web server, unfortunately, it is not possible to use the .htaccess file, but if you are looking for the ability to change php.ini values ​​using the nginx configuration file, this is done through the fastcgi_param directive (if PHP is configured as a FastCGI client):

Fastcgi_param PHP_VALUE upload_max_filesize=20M; fastcgi_param PHP_VALUE post_max_size=20M;

By the way, nginx has a directive client_max_body_size, which is responsible for the maximum size of data transmitted in HTTP requests. It also affects the maximum size of uploaded files. For changes to the nginx configuration file to take effect, the web server must be rebooted.

Using the ini_set() function

The upload_max_filesize and post_max_size directives can also be changed using the PHP ini_set() function in the wp-config.php file or using a plugin if this is allowed in the interpreter settings:

Ini_set("upload_max_size" , "20M"); ini_set("post_max_size", "20M");

Filter upload_size_limit

WordPress has a special upload_size_limit filter used in the wp_max_upload_size() function. This filter is responsible for the maximum size of downloaded files. The default value is the smallest of upload_max_filesize and post_max_size from the php.ini file, and this filter can only be used within this value.

If you have increased the size of the uploaded files using the methods described above, and WordPress still shows you a value less than the set value, look for plugins that can use this filter and deactivate them.

By the way, you can use this filter to decrease maximum upload file size in a small native plugin:

Function my_upload_size_limit($limit) ( add_filter("upload_size_limit", "my_upload_size_limit"); return wp_convert_hr_to_bytes("5M"); )

If you have tried all the methods but are still unable to increase the maximum file size in WordPress, we recommend that you seek your help.

Much more often we are asked: How to crop a photo? We have already written about this. And the topic “How to increase the size of a photo?” wasn’t included there, so let’s talk about it separately.

The truth is that any increase in photo size results in us seeing the small details of the image better. This means that all failures will be more noticeable. Up to a certain degree of magnification, this will not affect the quality of the image in any way. Of course, if it is not damaged in the first place. Agree, it’s naive to believe that you can take a bad frame, enlarge it, and it will suddenly become good. Of course not.

But making sure that the frame does not become worse when enlarged is quite a feasible task. This is another reason why you should resize a photo on your computer rather than using an online service. In paint.net, for example, you can immediately apply various effects to improve the result, if necessary.

Three facts you might not know about photo enlargement.

  1. It’s a fact and it’s the answer to the most common question: “How to increase the size of a photo without losing quality?” In the Paint and paint.net programs, you can safely increase the image size by 2 - 3 times without losing the quality noticeable to the eye.
  2. Fact. Processing photos on a computer gives better quality results than online services. Because online services, when uploading a photo, compress it in order to speed up processing and reduce the load on their resources.
  3. Fact. When the size of a photograph increases, for example, by 3 times, its “weight” can increase by 4-5 times. The dependence here is nonlinear.

So, let's look at 3 ways to enlarge images:

In Paint, you can increase the size of the picture:

  1. in pixels,
  2. as a percentage,
  3. while maintaining proportions,
  4. without maintaining proportions.

In paint.net the photo size can be increased:

  • in pixels,
  • in centimeters (print size),
  • as a percentage,
  • while maintaining proportions,
  • without maintaining proportions.

In Monosnep the image can be enlarged:

  • in pixels,
  • while maintaining proportions,
  • without maintaining proportions.

Increase photo size in Paint

Open the built-in editor. “Start”, “Accessories - Windows”, “Paint”.

Open Paint

Open an image in the program. Click File, then Open. From the menu, select the editor command “Resize”. The Resize Settings dialog box appears. In the screenshot below there are three of them, in fact, of course, there is only one window.

In our figure, the number 1 indicates the percentage resizing setting. The simplest option. Since the “Keep proportions” checkbox is checked, you just need to change one value, the second will change automatically.

Under number 2, the photo size increase setting is switched to pixels. The proportions are also preserved, so no matter if you change the width or height, the second size will change in proportion to the first.

In the last example, number 3, the “Keep proportions” checkbox is unchecked. Therefore, we increased the vertical size of the photo to 600 pixels, and the horizontal size remained the same - 1200. It is clear that in this case, when we click “OK”, the image will be slightly elongated upward

If you chose the wrong size to enlarge your photo, don’t worry. You can cancel any action in Paint using the arrow located at the top of the program menu. There are two of them, actually. Left is a step back, right is a step forward.


Paint, undo arrow

Increase photo size in paint.net

In this program, unlike the previous one, it is possible to increase the size of the photo in centimeters. The program is free, simple, convenient and, compared to Paint, quite multifunctional. You can download it here: https://www.dotpdn.com/downloads/pdn.html The installation is simple, without any hidden surprises, so I won’t describe it.

Launch the program. Open the desired file. "File", "Open...". In the menu, click “Image” and select “Resize” from the list of commands that opens.

It’s immediately clear that there are more photo resizing settings here. Here are the promised centimeters. You can also increase the photo size in inches, but for us this is already exotic. The principle of maintaining proportions is the same as in the previous description. If you want to save, leave a checkmark; if you want to stretch or compress the photo, shoot.

What’s also good about this program is the ability to edit the resulting result. Pay attention to “Effects” in the menu. The very first line is “For photographs”, and there are several cool tools for processing.

How to improve an enlarged photo in paint.net

So, in the main menu of the program there are several tools for improving image quality. We will use them when increasing the size of the photo.


Paint.net effects to improve photo quality
  1. Portrait.
  2. Sharpness.
  3. Glow.

That’s why we won’t consider the “Vignette” and “Red-Eye Removal” effects. Of course, they can be used, but they have no direct relationship to improving the quality of an enlarged photo.

1.Portrait. The name speaks volumes about its purpose. If you enlarge the size of a photo that shows a portrait of a person, then be sure to try applying this processing. Three parameters are available for configuration:

  1. softening,
  2. Illumination,
  3. Heat.

2.Sharpness. This processing is more suitable for landscapes, panoramic shots and screenshots from the monitor and is not suitable for people's faces. Everything is simple here. Change the Sharpening Amount parameter and watch how the image changes.

3.Glow. A good, almost universal tool for a wide variety of shots. Manage your photo settings:

  • Contrast,
  • Brightness,
  • Radius.

Practice shows that if the frame was initially of good quality, then these tools are quite enough to correct possible little things after enlarging it.

Enlarge photo size using Monosnep screenshot

The fastest, easiest way. No options other than choosing sizes in pixels. True, you can immediately crop the photo and enlarge the frame in one action.

In general, Monosnep is just an excellent screenshot. You can record video from the screen, capture pictures, and take screenshots of games. It’s also convenient because you can customize it for yourself. Select the same “hot keys”, the path for storing files. Download Monosnep from the official website https://monosnap.com/welcome

Here you can immediately crop the photo by selecting the desired area, or you can select the entire photo. To do this, use the mouse to move this crosshair over the corner of the photo. Left-click and hold the mouse and move the lines across the screen until you capture the desired area. Release the mouse button. At the bottom of the frame that appears, click the “Resize” button. A dialog box will appear in the center of the screen. Actually, everything else is clear:

  • decide whether to maintain proportions,
  • enter your new photo size values ​​in pixels,
  • click OK,
  • Click “Save” or “Load”.

Save—the enlarged photo will be saved to your computer. You can select the folder to save in the settings, and even if you go into the settings at the moment when the screenshot is taken and select a location to save the file, the file will be saved exactly in the folder you specified.

The question is how to increase the swap file, interests many PC users. The fact is that Windows OS tends to freeze often, because by default it works with disk RAM, loading drivers and all sorts of applications there until the memory is completely full. And after that, the system is “injected” into the hard drive, pumping information there, freeing up RAM for higher priority tasks. For this purpose, Windows uses a swap file called pagefile.sys, which is located in the root disk directory.

Since HDD is slower in operation than physical RAM, the following results: the more actively the OS pumps up, the slower the computer functions. Of course, expanding memory speeds things up because it reduces the need to use virtual memory.

Fixing the size of the paging file

Windows has very conservative default settings, but this is not a problem, since they can always be changed to improve performance. However, it should be remembered that it is advisable to experiment with these settings only if the system has a sufficiently large hard drive, that is, when it is possible to leave more disk space for virtual memory.

A decrease in performance due to standard settings can be caused by several reasons, and one of them is the growth of the paging file, which gradually becomes smaller and fragments very quickly. To get rid of this problem, you should know how to increase the swap file, that is, set and fix a certain file size. Fixing the file size will ensure a relatively stable amount of empty disk space. In the case when the hard drive is full, you should prevent Windows from “encroaching” on the last bit of disk free space.

The process of increasing the size of the paging file

In Windows 7, it is possible to create a paging file on all disks at the same time, but this will not speed up performance. Therefore, it should be understood how to increase the swap file and record its volume. To do this, proceed according to the instructions below.

  1. Go to “Start”, right-click on the “Computer” icon and expand the “Properties” tab, and then “Advanced Settings”.
  2. In the "Advanced" section, find "Performance" and click on "Options."
  3. On the page with performance parameters, you will need the “Advanced” section, in which click on “Change”.
  4. Turn off the "Automatic file size" option: this will allow you to get to the settings.
  5. For each disk, settings are specified separately. When there is only one logical disk, memory is initially enabled for it. When two or more logical drives are used, only the memory on the Windows drive will be activated by default.
  6. You should start with the drive that contains the page file. It is advisable to transfer this file to another disk so that when the operating system works with memory, the last juice is not “sucked out” from the main disk. Please note that the drive on which you plan to create the page file must have enough space to store it.
  1. Suppose the paging file is located on the system drive C:, and then it needs to be moved, say, to D:. It's done like this. First you need to remove the file from C:. Select drive C:, check the box “No paging file” and click on “Set”. When a warning appears, click “Yes”. A dialog box will open where you need to select D:. Place a tick on the “Specify size” line. Please note that the initial volume must match the volume of physical RAM, and the maximum volume must be twice as large. After that, click on “Set”.

If you've figured it out, how to increase the swap file, and changed its size parameter, you will immediately notice the change.

If your RAM capacity is six gigs or more, you can simply turn off the page file, freeing up the hard drive. To do this, check the box in the line “No paging file”, click on “Set”, agree (“OK”) and restart the PC.

Now you know how to increase the size of the paging file, and you can adjust its size yourself.