{"id":7950,"date":"2020-04-28T10:38:08","date_gmt":"2020-04-28T05:08:08","guid":{"rendered":"https:\/\/vividreal.co.in\/vividreal\/?p=7950"},"modified":"2020-04-28T10:38:08","modified_gmt":"2020-04-28T05:08:08","slug":"increasing-php-memory-limit-wordpress","status":"publish","type":"post","link":"https:\/\/vividreal.co.in\/vividreal\/increasing-php-memory-limit-wordpress\/","title":{"rendered":"Increasing PHP Memory Limit &#8211; WordPress"},"content":{"rendered":"<p><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><\/p>\n<p><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&#8217;ll have to manually increase the memory limit.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">You might have received the following error on your website:<\/span><\/p>\n<p><em><span style=\"font-weight: 400;\">Fatal error: Allowed memory size of 94371840 bytes exhausted (tried to allocate 5072 bytes).<\/span><\/em><\/p>\n<p><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>\n<p>P.S. If you need professional assistance with this, <a href=\"https:\/\/vividreal.co.in\/vividreal\/wordpress\/\">our expert team of WordPress ninjas<\/a> can help you out!<\/p>\n<h3><span style=\"color: #00ccff;\"><b>What is this error?<\/b><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Let&#8217;s understand what this error really is shall we? For those who don&#8217;t know, WordPress is programmed in PHP. Now PHP is a server-side programming language. Your website needs a WordPress hosting server to run.\u00a0<\/span><\/p>\n<p><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><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7954 aligncenter\" src=\"https:\/\/vividreal.co.in\/vividreal\/wp-content\/uploads\/2020\/04\/Screenshot_2020-04-07-15-23-21-01.png\" alt=\"\" width=\"932\" height=\"309\" srcset=\"https:\/\/vividreal.co.in\/vividreal\/wp-content\/uploads\/2020\/04\/Screenshot_2020-04-07-15-23-21-01.png 932w, https:\/\/vividreal.co.in\/vividreal\/wp-content\/uploads\/2020\/04\/Screenshot_2020-04-07-15-23-21-01-300x99.png 300w, https:\/\/vividreal.co.in\/vividreal\/wp-content\/uploads\/2020\/04\/Screenshot_2020-04-07-15-23-21-01-768x255.png 768w\" sizes=\"auto, (max-width: 932px) 100vw, 932px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">This error is usually seen when your code requires more memory than the already allocated default memory.<\/span><\/p>\n<p><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><\/p>\n<p>&nbsp;<\/p>\n<h3><span style=\"color: #00ccff;\"><b>How to increase PHP Memory limit in WordPress?<\/b><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">First, you&#8217;ll need to decide your memory limit. You&#8217;ll need to use an FTP client like FileZilla for this. Click here to download and start using FileZilla.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Install and open it. Here&#8217;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><\/p>\n<p><b>Host<\/b><span style=\"font-weight: 400;\"> \u2013 Your domain example: vividreal.com<\/span><\/p>\n<p><b>Port<\/b><span style=\"font-weight: 400;\"> \u2013 you can leave this blank<\/span><\/p>\n<p><b>Protocol<\/b><span style=\"font-weight: 400;\"> \u2013 FTP \u2013 File Transfer Protocol<\/span><\/p>\n<p><b>Encryption<\/b><span style=\"font-weight: 400;\"> \u2013 Only use plain FTP (insecure)<\/span><\/p>\n<p><b>Logon Type<\/b><span style=\"font-weight: 400;\"> \u2013 Normal<\/span><\/p>\n<p><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><\/p>\n<p><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&#8217;s files.<\/span><\/p>\n<h3><span style=\"color: #00ccff;\"><b>Finding your WordPress memory limit.<\/b><\/span><\/h3>\n<p><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><\/p>\n<p><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><\/p>\n<p><span style=\"font-weight: 400;\">WP_MAX_MEMORY_LIMIT gives you an indication of how much memory you&#8217;re allowed to use on the administrative side.<\/span><\/p>\n<h3><span style=\"color: #00ccff;\"><b>How to determine the amount of memory you need?<\/b><\/span><\/h3>\n<p><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.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">You&#8217;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&#8217;t increase it to more than what your site needs. Raising this number too high can make your server crash, so be careful!<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Okay, let&#8217;s start talking about the ways you can increase your memory limit. Before you start tweaking, clear your browser&#8217;s cookies and cache so that they do not affect how your website appears.\u00a0<\/span><\/p>\n<h3><span style=\"color: #00ccff;\"><b>Using php.ini<\/b><\/span><\/h3>\n<p><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><\/p>\n<p><i><span style=\"font-weight: 400;\">memory_limit 512M<\/span><\/i><\/p>\n<p><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&#8217;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.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If this doesn&#8217;t work, revert all changes made before trying out the following steps.<\/span><\/p>\n<h3><span style=\"color: #00ccff;\"><b>Using .htaccess<\/b><\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">You&#8217;ll need to find the .htaccess file, located in your root directory. There&#8217;s a chance that this file may be hidden, so if you&#8217;re using FileZilla, go to Server &gt; Force showing hidden files.<\/span><\/p>\n<p><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><\/p>\n<p><i><span style=\"font-weight: 400;\">php_value memory_limit 512M<\/span><\/i><\/p>\n<p><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&#8217;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><\/p>\n<h3><span style=\"color: #00ccff;\"><b>Using wp-config.php<\/b><\/span><\/h3>\n<p><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><\/p>\n<p><span style=\"font-weight: 400;\">Once you&#8217;ve found the file, simply copy-paste the code in the wp-config.php file. Paste it just before &#8220;That&#8217;s all, stop editing! Happy blogging.&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here&#8217;s the code:<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\">define( &#8216;WP_MEMORY_LIMIT&#8217;, &#8217;64M&#8217; );<\/span><\/i><\/p>\n<p><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><\/p>\n<p><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><\/p>\n<p><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><\/p>\n<p><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&#8217;s always better to get professional help if you do not know what you&#8217;re doing. If things are getting confusing for you, <a href=\"https:\/\/vividreal.co.in\/vividreal\/wordpress\/\">just give us a try<\/a>; we&#8217;d love to help!<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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! Your site [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":12878,"comment_status":"closed","ping_status":"open","sticky":false,"template":"wpb-single-post.php","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[38,183],"tags":[79,175,166,99,170,202],"class_list":["post-7950","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-development","category-wordpress","tag-design","tag-dev","tag-development","tag-shopify","tag-web","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/vividreal.co.in\/vividreal\/wp-json\/wp\/v2\/posts\/7950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vividreal.co.in\/vividreal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vividreal.co.in\/vividreal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vividreal.co.in\/vividreal\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/vividreal.co.in\/vividreal\/wp-json\/wp\/v2\/comments?post=7950"}],"version-history":[{"count":0,"href":"https:\/\/vividreal.co.in\/vividreal\/wp-json\/wp\/v2\/posts\/7950\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vividreal.co.in\/vividreal\/wp-json\/wp\/v2\/media\/12878"}],"wp:attachment":[{"href":"https:\/\/vividreal.co.in\/vividreal\/wp-json\/wp\/v2\/media?parent=7950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vividreal.co.in\/vividreal\/wp-json\/wp\/v2\/categories?post=7950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vividreal.co.in\/vividreal\/wp-json\/wp\/v2\/tags?post=7950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}