{"id":609,"date":"2024-06-16T09:13:21","date_gmt":"2024-06-16T09:13:21","guid":{"rendered":"https:\/\/zalvis.com\/docs\/?p=609"},"modified":"2024-06-16T09:13:21","modified_gmt":"2024-06-16T09:13:21","slug":"how-to-increase-your-php-maximum-execution-time","status":"publish","type":"post","link":"https:\/\/zalvis.com\/docs\/how-to-increase-your-php-maximum-execution-time.html","title":{"rendered":"How to Increase Your PHP Maximum Execution Time"},"content":{"rendered":"<p>An important aspect to remember about PHP programs is that the maximum time to execute a script is normally set to thirty seconds, although the time limit varies from one hosting company to another. Programs that involve sending mail to many recipients or some heavy export or import of files can cause the user to get errors of the maximum time limit exceeds.<\/p>\n<p>You might need to increase the limit for certain scripts your website uses. For instance, migration plugins in WordPress, depending on how big your website is, usually require a longer run time.<\/p>\n<p>Thirty seconds is the default setting, and you can increase that value. Keep in mind that the value is in seconds, so 2 minutes would be 120, 3 minutes would be 180, and so on. To find the correct value, you can check your plugin, script, or theme\u2019s documentation. You can use the phpinfo() function to verify the current value of the max_execution_time directive and other directives.<\/p>\n<p>If you\u2019re wondering how to set PHP maximum execution time on cPanel, we\u2019re going to do a quick step-by-step guideline for new learners that want to do this. The first thing you need to do once you log in to your cPanel account using your username and password or you can also log in via Zalvis Client Area.<\/p>\n<p>The next thing you want to do is find the PHP Selector button. After you\u2019ve selected this button, you will go to the Options section for the php.ini values and scroll down to max_execution_time.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-610\" src=\"https:\/\/zalvis.com\/docs\/wp-content\/uploads\/2024\/06\/IMG_8236.png\" alt=\"\" width=\"840\" height=\"299\" srcset=\"https:\/\/zalvis.com\/docs\/wp-content\/uploads\/2024\/06\/IMG_8236.png 840w, https:\/\/zalvis.com\/docs\/wp-content\/uploads\/2024\/06\/IMG_8236-300x107.png 300w, https:\/\/zalvis.com\/docs\/wp-content\/uploads\/2024\/06\/IMG_8236-768x273.png 768w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/p>\n<p>For Unlimited, you set the value to 0. Once you have done the change, make sure that you do a left-click anywhere outside the text input or dropdown box. If you\u2019ve managed to successfully follow the steps we\u2019ve mentioned above, you will be able to see a green box with a message that will confirm that the change you\u2019ve made has been applied.<\/p>\n<div class=\"heading-text\">\n<h2>Measuring Script Execution Time<\/h2>\n<\/div>\n<p>The time required to execute the PHP script is the script execution time in PHP. Rather than the CPU execution time, use clock time to calculate script execution time. What will help to know script execution time is knowing the clock time after script execution and before script execution.<\/p>\n<p>Use the microtime() function at the beginning and the end of the script. Then using formula (End_time \u2013 Start_time). Time returns in seconds with the microtime() function. Execution time depends on the processor, and it is not fixed.<\/p>\n<p>Now you know everything there is to know about increasing the maximum execution time of a script in cPanel. For any further assistance, make sure you contact us so we can help you!<\/p>\n<div class=\"dhpcq69e11c7ea4f88\" >If you enjoyed this article, then you\u2019ll love Zalvis's Cloud Hosting platform. Turbocharge your website and get 24\/7 support from our veteran team. Our world-class hosting infrastructure focuses on auto-scaling, performance, and security. Let us show you the Zalvis difference! <a href=\"https:\/\/zalvis.com\/\">Check out our services.<\/a><\/div><style type=\"text\/css\">\r\n@media screen and (min-width: 1201px) {\r\n.dhpcq69e11c7ea4f88 {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (min-width: 993px) and (max-width: 1200px) {\r\n.dhpcq69e11c7ea4f88 {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (min-width: 769px) and (max-width: 992px) {\r\n.dhpcq69e11c7ea4f88 {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (min-width: 768px) and (max-width: 768px) {\r\n.dhpcq69e11c7ea4f88 {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (max-width: 767px) {\r\n.dhpcq69e11c7ea4f88 {\r\ndisplay: block;\r\n}\r\n}\r\n<\/style>\r\n","protected":false},"excerpt":{"rendered":"<p>An important aspect to remember about PHP programs is that the maximum time to execute a script is normally set to thirty seconds, although the time limit varies from one hosting company to another. Programs that involve sending mail to many recipients or some heavy export or import of files can cause the user to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-609","post","type-post","status-publish","format-standard","hentry","category-cpanel-hosting"],"_links":{"self":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts\/609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/comments?post=609"}],"version-history":[{"count":2,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts\/609\/revisions"}],"predecessor-version":[{"id":612,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts\/609\/revisions\/612"}],"wp:attachment":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/media?parent=609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/categories?post=609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/tags?post=609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}