{"id":614,"date":"2024-06-03T17:22:24","date_gmt":"2024-06-03T17:22:24","guid":{"rendered":"https:\/\/thebeehost.com\/wiki\/?p=614"},"modified":"2024-10-07T20:40:49","modified_gmt":"2024-10-07T15:40:49","slug":"increase-php-limits-for-wordpress","status":"publish","type":"post","link":"https:\/\/thebeehost.com\/wiki\/increase-php-limits-for-wordpress\/","title":{"rendered":"Increase PHP Limits for WordPress"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><p>Managing a WordPress site often involves addressing performance issues and limitations caused by PHP settings. Increasing PHP limits can resolve many common problems such as memory allocation errors, maximum execution time exceeded, and file upload size limitations. This article explores how to increase PHP limits through <strong>.htaccess<\/strong> and <strong>wp-config.php<\/strong> files, providing a step-by-step guide to enhance your website&#8217;s capabilities.<\/p>\n<h2><b>Understanding PHP Limits<\/b><\/h2>\n<p>PHP, the scripting language that powers WordPress, has several configuration limits that can affect the functionality of your site. Some of them include:<br \/>\n<b><br \/>\nMemory Limit:<\/b> The maximum amount of memory a script can consume.<br \/>\n<b>Max Execution Time: <\/b>The maximum time a script is allowed to run before it is terminated.<br \/>\n<b>Upload Max Filesize:<\/b> The maximum file size that can be uploaded via PHP.<\/p>\n<p>By default, these settings are set conservatively to ensure stability across various server environments. However, as your website grows or requires more resources, these default limits may need adjustment.<\/p>\n<h2><b>Methods to Increase PHP Limits<\/b><\/h2>\n<h4><b>1. <\/b>Increasing PHP Limits via Hosting Control Panel<\/h4>\n<h4><em>cPanel<\/em><\/h4>\n<p>1. Log in to your cPanel dashboard.<br \/>\n2. Navigate to <strong>Software<\/strong> and click on <strong>MultiPHP INI Editor<\/strong>.<br \/>\n<img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-2367\" src=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-MultiPHP-INI-Editor-scaled.webp\" alt=\"\" width=\"2560\" height=\"1440\" srcset=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-MultiPHP-INI-Editor-scaled.webp 2560w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-MultiPHP-INI-Editor-300x169.webp 300w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-MultiPHP-INI-Editor-1024x576.webp 1024w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-MultiPHP-INI-Editor-768x432.webp 768w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-MultiPHP-INI-Editor-1536x864.webp 1536w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-MultiPHP-INI-Editor-2048x1152.webp 2048w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/>3. Select your domain from the options menu and scroll down to adjust <code>memory_limit<\/code>, <code>max_execution_time<\/code>, and <code>upload_max_filesize<\/code> as per the requirement.<br \/>\n<img decoding=\"async\" class=\"aligncenter size-full wp-image-2366\" src=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-Memory-limit-scaled-e1728315487384.webp\" alt=\"\" width=\"2551\" height=\"1440\" srcset=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-Memory-limit-scaled-e1728315487384.webp 2551w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-Memory-limit-scaled-e1728315487384-300x169.webp 300w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-Memory-limit-scaled-e1728315487384-1024x578.webp 1024w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-Memory-limit-scaled-e1728315487384-768x434.webp 768w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-Memory-limit-scaled-e1728315487384-1536x867.webp 1536w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cPanel-Memory-limit-scaled-e1728315487384-2048x1156.webp 2048w\" sizes=\"(max-width: 2551px) 100vw, 2551px\" \/>4. Save the changes, and the new limits will be applied instantly.<br \/>\n<img decoding=\"async\" class=\"aligncenter size-full wp-image-2365\" src=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cP-Apply-Changes-scaled.webp\" alt=\"\" width=\"2560\" height=\"1440\" srcset=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cP-Apply-Changes-scaled.webp 2560w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cP-Apply-Changes-300x169.webp 300w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cP-Apply-Changes-1024x576.webp 1024w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cP-Apply-Changes-768x432.webp 768w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cP-Apply-Changes-1536x864.webp 1536w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/cP-Apply-Changes-2048x1152.webp 2048w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<h4><em>DirectAdmin<\/em><\/h4>\n<p>1. Log in to your DirectAdmin dashboard.<br \/>\n2. In the Account Manager section, click on <strong>PHP Settings<\/strong>.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2363\" src=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DirectAdmin-Account-Manager-scaled.webp\" alt=\"\" width=\"2560\" height=\"1440\" srcset=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DirectAdmin-Account-Manager-scaled.webp 2560w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DirectAdmin-Account-Manager-300x169.webp 300w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DirectAdmin-Account-Manager-1024x576.webp 1024w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DirectAdmin-Account-Manager-768x432.webp 768w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DirectAdmin-Account-Manager-1536x864.webp 1536w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DirectAdmin-Account-Manager-2048x1152.webp 2048w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/>3. Modify PHP settings such as\u00a0 <code>memory_limit<\/code> and <code>max_execution_time<\/code> from this interface as needed.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2364\" src=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/PHP-Settings-scaled.webp\" alt=\"\" width=\"2560\" height=\"1440\" srcset=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/PHP-Settings-scaled.webp 2560w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/PHP-Settings-300x169.webp 300w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/PHP-Settings-1024x576.webp 1024w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/PHP-Settings-768x432.webp 768w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/PHP-Settings-1536x864.webp 1536w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/PHP-Settings-2048x1152.webp 2048w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2362\" src=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/Memory-limit-scaled.webp\" alt=\"\" width=\"2560\" height=\"1440\" srcset=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/Memory-limit-scaled.webp 2560w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/Memory-limit-300x169.webp 300w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/Memory-limit-1024x576.webp 1024w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/Memory-limit-768x432.webp 768w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/Memory-limit-1536x864.webp 1536w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/Memory-limit-2048x1152.webp 2048w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/>4. Save the changes to apply the new settings.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2361\" src=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DA-Add-Changes-scaled.webp\" alt=\"\" width=\"2560\" height=\"1440\" srcset=\"https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DA-Add-Changes-scaled.webp 2560w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DA-Add-Changes-300x169.webp 300w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DA-Add-Changes-1024x576.webp 1024w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DA-Add-Changes-768x432.webp 768w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DA-Add-Changes-1536x864.webp 1536w, https:\/\/thebeehost.com\/wiki\/wp-content\/uploads\/2024\/06\/DA-Add-Changes-2048x1152.webp 2048w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<h4><b>2. .htaccess File<\/b><\/h4>\n<p>The .htaccess file is a configuration file used by Apache-based web servers to manage settings for directories and their contents. It can be used to modify PHP settings for a specific directory.<\/p>\n<h4><b>Steps to Modify .htaccess:<\/b><\/h4>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\">Access your website\u2019s root, usually the <b>\u201cpublic_html\u201d<\/b> directory using FTP or the hosting account file manager.<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\">Open the <b>\u201c.htaccess\u201d<\/b> file in a text editor.<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\">Add the following lines at the end of the file to increase PHP limits:\n<pre><code>php_value memory_limit 256M\r\nphp_value max_execution_time 300\r\nphp_value upload_max_filesize 128M\r\nphp_value post_max_size 128M\r\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<h4><b><br \/>\n3. wp-config.php File<\/b><\/h4>\n<p>The wp-config.php file is a critical configuration file for WordPress, controlling various settings including database connection details and security keys. It can also be used to adjust PHP limits.<\/p>\n<h3><b>Steps to Modify wp-config.php:<\/b><\/h3>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\">Use an FTP client or your hosting account\u2019s file manager to navigate to the root directory, usually named <strong>&#8220;public_html&#8221;<\/strong>.<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\">Open the <strong>&#8220;<\/strong><b>wp-config.php&#8221;<\/b>\u00a0file in a text editor.<\/li>\n<\/ol>\n<h4><b><br \/>\nIncreasing Memory Limit<\/b><\/h4>\n<p>Add the following line before the comment <span style=\"background-color: #fff;\"><code>\/* That's all, stop editing! Happy blogging. *\/<\/code><\/span>:<\/p>\n<pre><code>define( 'WP_MEMORY_LIMIT', '256M' );<\/code><\/pre>\n<h4><b><br \/>\nIncreasing Maximum Execution Time<\/b><\/h4>\n<p>While wp-config.php does not directly support setting max_execution_time, you can add this configuration to your .htaccess file as mentioned above.<\/p>\n<h4><b><br \/>\nIncreasing Maximum File Upload Size<\/b><\/h4>\n<p>This setting is typically handled via .htaccess, but can also be adjusted in php.ini if you have access.<\/p>\n<h2><b>Balancing Performance and Security<\/b><\/h2>\n<h4><b>Resource Allocation<\/b><\/h4>\n<p>Setting limits too high can exhaust server resources, affecting not only your site but others on a shared server. It&#8217;s important to monitor resource usage and adjust limits based on actual needs.<\/p>\n<h4><b>Security Considerations<br \/>\n<\/b><\/h4>\n<p>Allowing scripts to run for extended periods or consume large amounts of memory can open up vulnerabilities to attacks, such as denial of service (DoS). Always ensure your site is updated and secure before making these changes.<\/p>\n<h4><b>Server Performance<\/b><\/h4>\n<p>Higher limits can improve user experience by reducing timeouts and errors but may lead to slower server response times if resources are overcommitted.<\/p>\n<p>Increasing PHP limits through <b>.htaccess<\/b> and <b>wp-config.php<\/b> files is a powerful way to enhance the performance and capabilities of your WordPress site. However, it requires careful consideration of server compatibility, resource allocation, and security implications. Always back up your site before making changes and test thoroughly to ensure the adjustments meet your needs without introducing new issues.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"tmnf_excerpt\"><p>Managing a WordPress site often involves addressing performance issues and limitations caused by PHP settings. Increasing PHP limits can resolve many common problems such as memory allocation errors, maximum execution time exceeded, and file upload size limitations. This article explores how to increase PHP limits through .htaccess and wp-config.php files, providing a step-by-step guide to &hellip;<\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[5],"tags":[72,68,70],"class_list":["post-614","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-fix-memory-allocation-error-wordpress-php","tag-how-to-increase-php-memory-limit-in-wordpress","tag-increase-upload-max-filesize-wordpress-htaccess"],"_links":{"self":[{"href":"https:\/\/thebeehost.com\/wiki\/wp-json\/wp\/v2\/posts\/614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thebeehost.com\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thebeehost.com\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thebeehost.com\/wiki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thebeehost.com\/wiki\/wp-json\/wp\/v2\/comments?post=614"}],"version-history":[{"count":1,"href":"https:\/\/thebeehost.com\/wiki\/wp-json\/wp\/v2\/posts\/614\/revisions"}],"predecessor-version":[{"id":2633,"href":"https:\/\/thebeehost.com\/wiki\/wp-json\/wp\/v2\/posts\/614\/revisions\/2633"}],"wp:attachment":[{"href":"https:\/\/thebeehost.com\/wiki\/wp-json\/wp\/v2\/media?parent=614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thebeehost.com\/wiki\/wp-json\/wp\/v2\/categories?post=614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thebeehost.com\/wiki\/wp-json\/wp\/v2\/tags?post=614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}