<span style="font-weight: 400;">PHP comes with default settings that may need to be changed according to the scope and size of the website project. One of these is the memory limit. In this article, we shall explore how we can increase the memory limit for the better working of a website, that obviously needs more memory!</span>

<span style="font-weight: 400;">Your site may need extra memory to run a new process. When processing a website, PHP allocates a default amount of memory for it. But when this need becomes greater you'll have to manually increase the memory limit.</span>

<span style="font-weight: 400;">You might have received the following error on your website:</span>

<em><span style="font-weight: 400;">Fatal error: Allowed memory size of 94371840 bytes exhausted (tried to allocate 5072 bytes).</span></em>

<span style="font-weight: 400;">This is a really common error. Luckily, we have an easy fix for this. Read on to know more.</span>

P.S. If you need professional assistance with this, <a href="https://vividreal.com/wordpress/">our expert team of WordPress ninjas</a> can help you out!
<h3><span style="color: #00ccff;"><b>What is this error?</b></span></h3>
<span style="font-weight: 400;">Let's understand what this error really is shall we? For those who don't know, WordPress is programmed in PHP. Now PHP is a server-side programming language. Your website needs a WordPress hosting server to run. </span>

<span style="font-weight: 400;">These web servers are computers that need memory to run different applications. A specific amount of memory is allocated to different applications, including PHP.</span>

<img class="size-full wp-image-7954 aligncenter" src="https://vividreal.com/wp-content/uploads/2020/04/Screenshot_2020-04-07-15-23-21-01.png" alt="" width="932" height="309" />

<span style="font-weight: 400;">This error is usually seen when your code requires more memory than the already allocated default memory.</span>

<span style="font-weight: 400;">The other ways this memory problem can manifest itself are issues like the white screen of death and the 500 internal server error.</span>

&nbsp;
<h3><span style="color: #00ccff;"><b>How to increase PHP Memory limit in WordPress?</b></span></h3>
<span style="font-weight: 400;">First, you'll need to decide your memory limit. You'll need to use an FTP client like FileZilla for this. Click here to download and start using FileZilla. </span>

<span style="font-weight: 400;">Install and open it. Here's how you can start using FileZilla. Go to File &gt; Site manager and give your site a name. Then under the General tab, enter details as shown:</span>

<b>Host</b><span style="font-weight: 400;"> – Your domain example: vividreal.com</span>

<b>Port</b><span style="font-weight: 400;"> – you can leave this blank</span>

<b>Protocol</b><span style="font-weight: 400;"> – FTP – File Transfer Protocol</span>

<b>Encryption</b><span style="font-weight: 400;"> – Only use plain FTP (insecure)</span>

<b>Logon Type</b><span style="font-weight: 400;"> – Normal</span>

<span style="font-weight: 400;">Enter the user and password details of your WordPress site. If your website uses cPanel, enter the login details of cPanel.</span>

<span style="font-weight: 400;">Now go to Transfer Settings, and check the box that says Limit Number of Simultaneous Connections. In the Maximum Number of Connections, enter 8. Finally, click on connect to access your website's files.</span>
<h3><span style="color: #00ccff;"><b>Finding your WordPress memory limit.</b></span></h3>
<span style="font-weight: 400;">After the above steps, you need to find a file named default-constants.php in the root folder of your website (public_html).</span>

<span style="font-weight: 400;">Open the wp-includes file, and find the default-constants.php file. Save it to your computer and open it using notepad. The website memory limit will be visible in a few lines of code.</span>

<span style="font-weight: 400;">WP_MAX_MEMORY_LIMIT gives you an indication of how much memory you're allowed to use on the administrative side.</span>
<h3><span style="color: #00ccff;"><b>How to determine the amount of memory you need?</b></span></h3>
<span style="font-weight: 400;">The amount of memory your WordPress website needs depends on the number of plugins you have, and even on all the media your website contains. </span>

<span style="font-weight: 400;">You'll need to decide on a memory limit which is higher than what you found in your default-constants.php in the step above. You may need to find out the amount of memory you need through trial and error. Increase your memory limit manually, bit by bit until the issues of your website have been resolved. You shouldn't increase it to more than what your site needs. Raising this number too high can make your server crash, so be careful!</span>

<span style="font-weight: 400;">Okay, let's start talking about the ways you can increase your memory limit. Before you start tweaking, clear your browser's cookies and cache so that they do not affect how your website appears. </span>
<h3><span style="color: #00ccff;"><b>Using php.ini</b></span></h3>
<span style="font-weight: 400;">In your wp-admin folder, find the php.ini or php5.ini file, download it to your computer. Find the below code and edit it as such:</span>

<i><span style="font-weight: 400;">memory_limit 512M</span></i>

<span style="font-weight: 400;">Upload it back to the wp-admin folder, overwrite the original file, refresh the FTP client, and reload your page to see if the issue has been solved. If it hasn't, try increasing the value from 512M to another value. You can also try renaming the file from php.ini to php5.ini and vice versa. </span>

<span style="font-weight: 400;">If this doesn't work, revert all changes made before trying out the following steps.</span>
<h3><span style="color: #00ccff;"><b>Using .htaccess</b></span><span style="font-weight: 400;"> </span></h3>
<span style="font-weight: 400;">You'll need to find the .htaccess file, located in your root directory. There's a chance that this file may be hidden, so if you're using FileZilla, go to Server &gt; Force showing hidden files.</span>

<span style="font-weight: 400;">Once you find the .htaccess file, download it, make a copy and in the copy, add the following code, or edit it if already exists:</span>

<i><span style="font-weight: 400;">php_value memory_limit 512M</span></i>

<span style="font-weight: 400;">Save the file, upload it back to your root directory, refresh the FTP client and refresh your website to see if the issue has been solved. If not, try increasing the value. If this doesn't solve the issue, delete the copy and upload the original .htaccess file back to your root directory before you try any other step.</span>
<h3><span style="color: #00ccff;"><b>Using wp-config.php</b></span></h3>
<span style="font-weight: 400;">You need to find and edit the wp-config.php. You can find this in the root folder of your website.</span>

<span style="font-weight: 400;">Once you've found the file, simply copy-paste the code in the wp-config.php file. Paste it just before "That's all, stop editing! Happy blogging."</span>

<span style="font-weight: 400;">Here's the code:</span>

<i><span style="font-weight: 400;">define( 'WP_MEMORY_LIMIT', '64M' );</span></i>

<span style="font-weight: 400;">This tiny little code tells WordPress to increase the PHP memory limit to 64MB. Increase this value if needed.</span>

<span style="font-weight: 400;">Once done, save your changes and upload the wp-config.php file to the server, and refresh the website. The error message should have disappeared by now.</span>

<span style="font-weight: 400;">Now in the off chance that this does not work, it probably means that your web hosting server does not simply allow WordPress to increase PHP memory limit. The only workaround to this is to contact your hosting provider and request them to increase the PHP memory limit manually.</span>

<span style="font-weight: 400;">So there you have it, three simple ways you can increase your PHP memory limit for your WordPress website. Remember to create a backup of your website before you go tweaking! It's always better to get professional help if you do not know what you're doing. If things are getting confusing for you, <a href="https://vividreal.com/wordpress/">just give us a try</a>; we'd love to help!</span>