{"id":2101,"date":"2021-06-10T16:10:59","date_gmt":"2021-06-10T13:10:59","guid":{"rendered":"https:\/\/www.scalahosting.com\/kb\/?p=2101"},"modified":"2022-01-26T17:39:29","modified_gmt":"2022-01-26T15:39:29","slug":"how-to-change-the-php-memory-limit-for-scripts","status":"publish","type":"post","link":"https:\/\/www.scalahosting.com\/kb\/how-to-change-the-php-memory-limit-for-scripts\/","title":{"rendered":"How to Change the PHP Memory Limit for Scripts"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Like almost everything that runs on computers, <\/span><b>PHP scripts require memory<\/b> <i><span style=\"font-weight: 400;\">(RAM<\/span><\/i><span style=\"font-weight: 400;\">)<\/span><b> to operate<\/b><span style=\"font-weight: 400;\">. Not having access to sufficient memory can cause some scripts to fail, resulting in error messages instead of working web pages.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you encounter errors such as <\/span><b>\u201cFatal error: Allowed memory size of X bytes exhausted\u201d<\/b><span style=\"font-weight: 400;\"> then you may need to increase your PHP memory limits.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Increasing PHP Memory Limits via SPanel<\/span><\/h2>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Step 1.<\/b><span style=\"font-weight: 400;\"> Log in to your SPanel dashboard.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Step 2.<\/b><span style=\"font-weight: 400;\"> Click on \u201cPHP INI Editor\u201d under the \u201cTools\u201d section.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Step 3. <\/b><span style=\"font-weight: 400;\">Select the domain you wish to adjust memory limits for.<\/span><\/li>\n<li><b>Step 4. <\/b><span style=\"font-weight: 400;\">Under \u201cmemory_limit\u201d change the existing field to the new amount required. The figure should follow a Megabyte increment. For example, to set it to one gigabyte, use 1024M.<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-2102\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/PHP-Ini-Editor-1024x646.jpg\" alt=\"How to Change the PHP Memory Limit for Scripts, Increasing PHP Memory Limits via SPanel\" width=\"1024\" height=\"646\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/PHP-Ini-Editor-1024x646.jpg 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/PHP-Ini-Editor-300x189.jpg 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/PHP-Ini-Editor-768x485.jpg 768w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/PHP-Ini-Editor.jpg 1453w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/p>\n<h2><span style=\"font-weight: 400;\">Understanding PHP Memory Limits<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">The<\/span><b> PHP memory limit<\/b><span style=\"font-weight: 400;\"> is not an overall usage figure. It refers to the amount of memory usable for each visitor session. To illustrate this, let\u2019s take the example of a <\/span><b>128MB PHP memory limit. In this scenario<\/b><span style=\"font-weight: 400;\">, ten visitors concurrently on your site may result in memory usage of up to 1,280MB.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Setting excessive limits for <\/span><a href=\"https:\/\/www.scalahosting.com\/blog\/php-8-0-now-available-on-all-spanel-vps-servers\/\"><b>PHP<\/b><\/a><span style=\"font-weight: 400;\"> memory may result in overly high resource consumption, which will ultimately be limited by the amount of memory allocated to your hosting plan.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Like almost everything that runs on computers, PHP scripts require memory (RAM) to operate. Not having access to sufficient memory can cause some scripts to fail, resulting in error messages instead of working web pages. If you encounter errors such as \u201cFatal error: Allowed memory size of X bytes exhausted\u201d then you may need to [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":""},"categories":[33],"tags":[],"class_list":["post-2101","post","type-post","status-publish","format-standard","hentry","category-software"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/comments?post=2101"}],"version-history":[{"count":4,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2101\/revisions"}],"predecessor-version":[{"id":2857,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2101\/revisions\/2857"}],"wp:attachment":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/media?parent=2101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/categories?post=2101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/tags?post=2101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}