Skip to main content

When reloading a page, you may encounter the following error:

Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/content/core/lib/Drupal/Core/{some file .php} on line n

 

Solution

To resolve this issue, you need to adjust the max_execution_time parameter in the php.ini file.

Use the following command to locate your php.ini file:

php --ini

The response will be similar to

Configuration File (php.ini) Path: /usr/local/etc/php
Loaded Configuration File:         /usr/local/etc/php/php.ini

Open the php.ini file in a text editor. For example:

nano /usr/local/etc/php/php.ini

Find the max_execution_time setting. It may be set to 30 seconds by default

max_execution_time = 30

In my case this parameter wasn't set.  The parameter to change or add in the php.ini file is max_execution_time.

max_execution_time = 360

This sets the maximum execution time to 360 seconds.
Save the file and exit the text editor.
After modifying the php.ini file, restart Apache to apply the changes

service apache2 restart

 

Related articles

Andrew Fletcher04 Apr 2025
Managing .gitignore changes
When working with Git, the .gitignore file plays a critical role in controlling which files and folders are tracked by version control. Yet, many developers are unsure when changes to .gitignore take effect and how to manage files that are already being tracked. This uncertainty can lead to...
Andrew Fletcher26 Mar 2025
How to fix the ‘Undefined function t’ error in Drupal 10 or 11 code
Upgrading to Drupal 10.4+ you might have noticed a warning in their code editor stating “Undefined function ‘t’”. While Drupal’s `t()` function remains valid in procedural code, some language analysis tools — such as Intelephense — do not automatically recognise Drupal’s global functions. This...
Andrew Fletcher17 Mar 2025
Upgrading to PHP 8.4 challenges with Drupal contrib modules
The upgrade from PHP 8.3.14 to PHP 8.4.4 presents challenges for Drupal 10.4 websites, particularly when dealing with contributed modules. While Drupal core operates seamlessly, various contrib modules have not yet been updated to accommodate changes introduced in PHP 8.4.x. This has resulted in...