If you encounter this error that means, that work to do by Apache web server to handle your task was long-time and it was stopped by time limit provided by ini configuration in php. Such task as image resizing or huge files operations can last long. You can change setting of time limit in PHP by function set time limit, where you give max execution time in seconds as parameter.
You should be aware of this error message, because it should not take more than 30s to complete a script normally. Sometime, it may because of coding mistakes like (infinity loop in your code).
We strongly recommend you to contact your hosting provider and ask them to fix the issue for you.
There are two methods to solve this problem:
Method 1:Step 1 : Open php.ini; Step 2 : Modify the value of “max_execution_time” to a greater value say 600; Step 3: Restart Server.
Method 2 (Recommended):Add “set_time_limit(600)” in your code, where the input parameter is the max execution time, and 0 means unlimited.
But be aware. You can hung your server if your job is endless (like never ending loop), so don’t set this value too high.