How to set infinite execution time in a PHP script

PHP: How to set infinite execution time in a PHP script

Add the following code to set unlimited execution time for a PHP script:

  1. set_time_limit(0)

You can also update max_execution_time in php.ini

If the value is 0, it is actually unlimited. Otherwise it is that number of seconds.

webdevetc profile pic

I am a 29 year old backend web developer from London, mostly focusing on PHP and Laravel lately. This ( is my blog where I write about some web development topics (PHP, Laravel, Javascript, and some server stuff). contact me here.


Comments and discussion about How to set infinite execution time in a PHP script

Found this interesting? Maybe you want to read some more in this series?

Or see other topics in the PHP language

Or see other languages/frameworks:
PHP Laravel Composer Apache CentOS and Linux Stuff WordPress General Webdev and Programming Stuff JavaScript
Or see random questions

Force trailing slash (redirect if no trailing slash exists) in .htaccess

How to use subdomains as parameters in your routes (or in your web.php file)

How to sort an array of dates and times?

How can you check if a variable is alphanum (alphanumeric, letters and numbers only) in PHP?

How to find out what version of Laravel you are using?

What is the difference between reference and primitive data types types in Javascript?

How to destroy or remove a cookie in PHP

How to find out which php.ini file PHP is using?

How to review blog posts (written by other users) before they get published on your WordPress blog?

How to return an item in Eloquent, or throw a ModelNotFoundException exception if it isn't found?