To increase the PHP memory limit, the safest route is your hosting control panel: open the PHP settings and raise memory_limit to 256M. If your host has no panel option, add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php, or set memory_limit = 256M in php.ini or .user.ini. Always back up first.
upload_max_filesize and post_max_size together, and keep post_max_size equal to or larger than upload_max_filesize.phpinfo page to confirm which file is active.If you have ever seen a message like "Allowed memory size exhausted", a plugin that refuses to activate, or a theme upload that fails halfway, you have run into a PHP limit. These limits are guardrails your host sets so one site cannot use up all the server's resources. They are normal, and they are yours to adjust.
Setting them correctly fixes some of the most common WordPress headaches. A memory limit that is too low is a frequent cause of the WordPress white screen of death and the 500 internal server error. An upload limit that is too small blocks large themes, plugins, and media files. An outdated PHP version leaves your site slower and less secure than it needs to be.
This guide is for site owners on shared hosting, managed WordPress, or a VPS who want to change these values safely. Every task here has a control-panel method and a file-editing fallback. For a wider view of the errors these limits can trigger, see our server errors guide.
PHP is the server-side language that WordPress is built in. Every time someone loads a page, the server runs PHP to build it. PHP reads its rules from configuration files, and those rules include the limits below.
php.ini is the main PHP configuration file. It sets the default values for the whole server or your account. .user.ini is a smaller per-folder config file used on many shared hosts (those running PHP as CGI/FastCGI); it lets you override selected values just for your own site without touching the main file.
Here are the values this guide changes:
| Setting | What it controls | Typical value |
|---|---|---|
memory_limit | The most memory a single PHP script may use. Too low causes crashes and blank pages. | 256M |
upload_max_filesize | The largest single file you can upload. | 64M |
post_max_size | The largest total amount of data a form or upload can send. Must be equal to or larger than upload_max_filesize. | 64M |
max_execution_time | How many seconds a script may run before the server stops it. Large uploads and imports need more. | 300 |
| PHP version | Which release of PHP runs your site (for example 8.2 or 8.3). Newer is usually faster and safer. | 8.2+ |
The letter M means megabytes, so 256M is 256 megabytes. You can raise any of these, but do it in steps and only as far as your plan allows.
Before you change anything, find out what your site uses today. There are three easy ways.
info.php, put a single line in it, <?php phpinfo(); ?>, and upload it to your site's root folder. Visit yourdomain.com/info.php in a browser. It lists every value, including memory_limit, and the exact config file that is loaded (look for the "Loaded Configuration File" line). Delete the file when you are done, because it exposes server details.The safe, recommended way to switch PHP versions is through your hosting control panel, not by editing files. As of 2026, higher PHP versions such as 8.2 and 8.3 are usually noticeably faster and receive security updates, while older versions like 7.4 have reached end of life.
8.2 or 8.3, and save.If your panel offers separate PHP versions per site or per folder, change only the one for the site you are working on.
This is the change most people need. Try the methods below in order. The first one that works is the right one for your host; you do not need to do all five. A value of 256M is comfortable for most WordPress sites.
memory_limit, set it to 256M, and save. This is the cleanest method and survives most updates.wp-config.php in your site root and add define('WP_MEMORY_LIMIT', '256M'); just above the line that reads /* That's all, stop editing! */. To give the admin area more room, also add define('WP_MAX_MEMORY_LIMIT', '512M');.php.ini, add or change the line memory_limit = 256M, then save.memory_limit = 256M to a .user.ini file in your site root. Changes can take a few minutes to apply.php_value memory_limit 256M to your .htaccess file. Skip this on Nginx or LiteSpeed setups, which ignore it.phpinfo page or Site Health.wp-config.php or .htaccess. One misplaced character in these files can take the whole site down. Keep a copy of the original so you can undo any change instantly.To raise the max upload size you must change three values together: upload_max_filesize (the largest single file), post_max_size (the largest total submission), and often max_execution_time (so big uploads have time to finish). The golden rule: post_max_size must be equal to or larger than upload_max_filesize.
As with memory, start in the panel and only edit files if you must.
upload_max_filesize to 64M, post_max_size to 64M (or higher), and max_execution_time to 300, then save.php.ini: upload_max_filesize = 64M, post_max_size = 64M, and max_execution_time = 300..user.ini file instead.php_value upload_max_filesize 64M, php_value post_max_size 64M, and php_value max_execution_time 300.If you only need to import a large database or run a slow tool once, raising max_execution_time temporarily is often enough on its own.
post_max_size smaller than upload_max_filesize. The upload will silently fail. Always keep post_max_size equal to or larger..htaccess method on a server that ignores it. Many managed WordPress, Nginx, and LiteSpeed setups do not read php_value lines. Use the panel or .user.ini instead..user.ini but you edit php.ini, nothing happens. Check the "Loaded Configuration File" line in phpinfo first.phpinfo page, read the "Loaded Configuration File" line, edit that file, then clear the cache. This one check solves the large majority of "it won't change" cases. A memory limit that is still too low can keep triggering the white screen of death or a 500 error until it is raised on the file the server actually reads.A few habits keep these settings trouble-free:
wp-config.php, php.ini, .user.ini, or .htaccess when the panel has no option.If you regularly hit these limits even after raising them, the real issue may be that your plan is too small for your traffic or plugins. That is a hosting-capacity question rather than a settings one.
WordPress itself asks for at least 64M, but a real site with a theme and several plugins is comfortable at 256M. Heavy setups such as WooCommerce or page builders may want 512M. Start at 256M and raise it only if you still see memory errors.
Almost always because the value was set in a file the server does not load, or a cache is serving the old page. Open a phpinfo page, read the "Loaded Configuration File" line, edit that exact file, then clear every cache and reload. Some shared plans also cap the maximum, so a very high value may be refused.
Usually yes, and it is worth doing, because newer versions are faster and more secure. The risk is an old plugin or theme that has not been updated. Back up first, confirm your key plugins support the version, ideally test on staging, and keep the option to switch back if a page breaks.
Its location varies by host. The reliable way to find it is a phpinfo page: the "Loaded Configuration File" line shows the exact path. On many shared hosts you will not edit php.ini directly at all; you use the panel or a per-folder .user.ini file in your site root instead.
Raise upload_max_filesize and post_max_size to the same value, for example 64M, keeping post_max_size equal to or larger, and raise max_execution_time if big files time out. Do it in your hosting panel first; if there is no option, use php.ini or .user.ini. Check the result under Media → Add New.
php.ini is the main configuration file that sets defaults for the whole server or account. .user.ini is a smaller per-folder file that overrides selected values just for your site, used on hosts that run PHP as CGI or FastCGI. If your host uses .user.ini, edit that; changes may take a few minutes to apply.
Changing PHP settings is straightforward once you know the order: check your current values with a phpinfo page, then make the change in your hosting control panel first and fall back to wp-config.php, php.ini, or .user.ini only if needed. Raise memory_limit to 256M to stop crashes, keep post_max_size at least as large as upload_max_filesize for uploads, and back up before switching PHP versions.
If a wrong value has already broken your site, your next step is our server errors guide, which maps each symptom to a fix, including the JSON response error you can hit after a failed upload.
.user.ini files (php.net documentation).WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT.The editorial team behind the Bitrich777 Hosting Help Center — practical, tested guides on web hosting, WordPress, servers, DNS, SSL, email, security and migration. Every walkthrough is reproduced on a live host before it is published.
View all guides by the Hosting Team Spotted an error? Tell us