Fetal error is one of the major issue in the php and all php programmer facing lots of issue day by day in php language. some time you get Fatal error: Maximum execution time of 30 seconds exceeded in filename, basically this is the server issue, on the Apache server there is a number of seconds set to run the script, once that second finished and still not finish the execution of your php statements then you get this error.
On the server the default limit is 30 seconds, and you can find this in the php.ini file where you search the keyword ‘max_execution_time’ then you get the value set beside it. you can directly reset it in the php.ini file and it will apply on all the files. while if you want to set in any php file then you can set it using below statement.
When above statement called in your php file then set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 120 seconds into script execution a call such as set_time_limit(120) is made, the script will run for a total of 120+30 seconds before timing out.
When you set set_time_limit(0) then its run for unlimited time, i mean its do not stop execution up to the end of your file.