SCSS Max Execution Time Reached

If you have a site where the theme is not displaying correctly and you have confirmed it is not related to problems loading CSS (e.g. not securely over https), then you might be seeing an error like this in the logs:

Maximum execution time of 12 seconds exceeded in lib/scssphp/Compiler.php on line 4248
[08-Jul-2020 11:04:25 Australia/Melbourne] PHP Stack trace:
[08-Jul-2020 11:04:25 Australia/Melbourne] PHP   1. {main}() /theme/styles.php:0

If that's the case, try the following. First in config.php you'll need to increase the execution time by adding the line towards the top. Note this is a good way to introduce any other PHP settings to Moodle.

ini_set('max_execution_time', 600);

Second, run the admin/cli/build_theme_css.php CLI tool. This will use the max_execution_time in config.php and eventually build the the theme CSS.

Note, it can take a long time so set this to a high enough value e.g. at least a few minutes. I used 300 (5 mins). Also this didn't work from the browser, only the CLI.

Make sure you remove the max execution time setting from config.php when you are done!
No Comments
Back to top