Before you begin
You will need:
Access to your website's hosting control panel (such as cPanel or Windows Control Panel).
The specific URL or action that triggers the error (e.g., a large file upload, a complex database export, or a heavy plugin process).
Check the script's complexity and resource usage
Before modifying server settings, determine if the error is caused by a poorly optimized script or a legitimate, resource-intensive task.
Identify the specific action triggering the error.
If the error occurs during a standard page load, the script may be poorly optimized or stuck in a loop.
If the error occurs during a specific administrative task (like importing a large database or processing a large image), the task may simply require more time than the default limit allows.
Increase the PHP Maximum Execution Time
If the error occurs during a necessary, heavy process, you can increase the time limit allowed for PHP scripts to run.
Via your hosting control panel
Most Hostek accounts allow you to modify PHP settings directly through the control panel.
Log in to your hosting control panel.
Locate the PHP Selection or Select PHP Version tool.
Select the version of PHP currently used by your website.
Find the
max_execution_timesetting.Increase the value (e.g., from
30to300).Save the changes.
Via a .user.ini or php.ini file
If your hosting environment supports local configuration files, you can override the global limit for a specific website.
Use a File Manager or FTP client to navigate to your website's root directory.
Locate or create a file named
.user.ini(orphp.inidepending on your server configuration).Add or edit the following line:
max_execution_time = 300Save the file and refresh your website.
Note: The value is in seconds. A value of 300 allows the script to run for 5 minutes.
Identify and resolve script loops
If the error occurs on a standard page load and the script is not performing a heavy task, there may be a coding error.
Enable PHP error reporting to see the specific file and line number where the script stops.
Check for "infinite loops" in your code (e.g., a
whileorforloop that never meets its exit condition).If using a CMS like WordPress, deactivate the most recently updated plugin or theme to see if the error persists.
Confirm the result
The specific action that previously timed out (such as a large upload or a complex search) now completes successfully.
The "Maximum Execution Time Exceeded" error message no longer appears on the site.
Troubleshooting common causes
The error only occurs during a large file upload. This may be caused by a low post_max_size or upload_max_filesize rather than the execution time. Check these settings in your PHP configuration to ensure they are large enough to accommodate your files.
The error occurs immediately upon loading the homepage. This usually indicates a script error or a plugin conflict. Check your error logs to identify the specific file causing the issue.
Limitations
Increasing the max_execution_time allows a script to run longer, but it does not make the script run faster. If a script is poorly written, it may still hit the limit or consume excessive server resources even with a higher limit. If you frequently need to run very long processes, consider using a background task or a cron job.
