In this post I will show you how to fix: PHP Fatal error: Maximum execution time of 30 seconds exceeded.
Table of Contents
PHP is an open-source programming language, which means it is free to use and that anybody may modify and share it. It is also one of the most used server-side scripting languages, with most web hosting providers supporting it. PHP is used to power some of the most popular CMS (Content Management Systems) such as WordPress, Joomla, and Drupal.
OpenLiteSpeed is a high-performance, lightweight, open-source web server software designed to handle heavy traffic and PHP, Python", and Ruby on Rails applications. It is a full-featured web server that can be readily combined with other web-based technologies like as WordPress", Joomla, and Magento. OpenLiteSpeed additionally offers a web-based control panel for simple server administration and monitoring. Web developers, hosting companies, and website administrators all utilise it.
PHP Fatal error: Maximum execution time of 30 seconds exceeded
This is an error message indicating that a PHP script’s execution time has surpassed the maximum permitted of 30 seconds. This can be caused by a number of circumstances, including an endless loop, a sluggish database" query, or the processing of a significant volume of data.
You can try raising the maximum execution time limit in your PHP setup, optimising your code to execute more effectively, or dividing your script into smaller, more manageable portions to resolve this issue.
Fix Maximum execution time of 30 seconds exceeded
There are a few ways to increase the maximum allowed execution time in PHP:
- Using the
ini_set()function: This function can be used to set the value of a configuration option at runtime. To increase the maximum execution time, you can use the following code:
ini_set('max_execution_time', 300);This will set the maximum execution time to 300 seconds (5 minutes).
- Modifying the
php.inifile is the main configuration file for PHP. You can open" this file in a text editor and find the line that sets the
max_execution_timeoption. Change the value to the desired number of seconds.
- Modifying the
.htaccessfile: If you don’t have access to the
php.inifile, you can also set the maximum execution time in the
.htaccessfile. Add the following line to the file:
php_value max_execution_time 300This will set the maximum execution time to 300 seconds (5 minutes).
OpenLiteSpeed Docker Change max_execution_time
To change the maximum execution time in OpenLiteSpeed running in a Docker container, you will need to make changes to the PHP configuration files.
Here is an example of how you can do this:
docker exec -it <container-name> /bin/bash
- Find your PHP configuration file.
ls -l /usr/local/lsws/lsphp[version]/etc/
- open" the PHP configuration file (php.ini)
- Find the line with the max_execution_time setting and change it to the desired number of seconds.
max_execution_time = 300
- Save and exit the file.
- Restart the OpenLiteSpeed container
docker restart -lt <container-name>
- Verify that the new setting has been applied
php -i | grep max_execution_time
Note that the above steps are for a OpenLiteSpeed with the PHP version embedded, if you are using the PHP-FPM version, the path to the php.ini file may change, but the steps will remain the same.
That’s all about: PHP Fatal error: Maximum execution time of 30 seconds exceeded.
You can try raising the maximum execution time limit in the PHP settings, optimising the code to execute more effectively, or dividing the script into smaller, manageable portions to resolve this issue.
I hope that I helped you to solve your problems.
Could You Please Share This Post? I appreciate It And Thank YOU! :) Have A Nice Day!
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?