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

How to find the intersection (same values) from two arrays?

How to block IPv6 IP addresses in .htaccess

How to make Apache force download of files (in .htaccess)

How to block an IP range based on CIDR in Apache with .htaccess

How do you launch the PHP interactive shell?

How to hide the server signature (hide Apache info) from HTTP headers with .htaccess

How to find the average value of items in a Laravel Collection?

How to find the 2nd most common item in an array?

How to block IP addresses in Apache by using regular expressions (regex) in .htaccess

What kind of database field type should you (normally) use for foreign keys?