[5.x]: PHP Process Spiking With `Unable To Find Template "x"` Error.

by ADMIN 69 views

[5.x]: PHP process spiking with Unable to find template "x" error

What happened?

A multi-page website with a multi-page Formie form is experiencing intermittent outages due to a spike in the PHP process. The issue is caused by an error in the stderr output, which is related to the Craft CMS vendor. The error is triggered when submitting the form, and it results in a fatal error and a maximum execution time exceeded error.

Description

The website loads fine, and the form page loads fine. However, when submitting the form, it correctly pushes the form submission through to the Formie submissions as a partially completed form. At the same time, it spawns the below errors in stderr, which in turn causes a spike in the PHP process.

The error is as follows:

2025-04-22@15:52:20 production php stderr [22-Apr-2025 14:52:20 UTC] PHP Fatal error: Maximum execution time of 120 seconds exceeded in /var/www/html/vendor/yiisoft/yii2/base/Event.php on line 223
2025-04-22@15:52:20 production php stderr [22-Apr-2025 14:52:20 UTC] PHP Fatal error: Uncaught craft\web\twig\TemplateLoaderException: Unable to find the template “pagesHce”. in /var/www/html/vendor/craftcms/cms/src/web/twig/TemplateLoader.php:108

This error is causing intermittent outages on the website, and it can only be resolved by restarting the instance entirely to kill anything in the PHP process.

Additional information

The issue has only appeared since upgrading to Craft 5. The site appears to work perfectly fine, and the pages are correctly loading. However, the error is spawning in the background, and it's unclear if this is a Formie issue or a Craft issue.

System configuration

  • Craft CMS version: 5.6.11
  • PHP version: 8.2.27
  • Operating system and version: Linux 6.1.0-27-amd64
  • Database type and version: MySQL 28.1
  • Image driver and version: Imagick 3.7.0 (ImageMagick 7.1.1-41)
  • Installed plugins and versions:
    • Blitz: 5.9.12
    • Cookies: 5.0.0
    • Feed Me: 6.8.0
    • Field Manager: 4.0.3
    • Formie: 3.0.21
    • Openbanking: 1.0.1
    • Redactor: 4.2.0
    • Retour: 5.0.8
    • SEOmatic: 5.1.11
    • Servd Assets and Helpers: 4.0.15
    • Sherlock: 5.1.0

Possible causes

  1. Template caching issue: The error message suggests that there is a problem with the template caching. This could be due to a misconfigured template cache or a conflict with another plugin.
  2. Plugin conflict: The error message suggests that there is a conflict between the Formie plugin and the Craft CMS vendor. This could be due to a misconfigured plugin or a conflict with another plugin.
  3. Database issue: The error message suggests that there is a problem with the database. This could be due to a misconfigured database or a conflict with another plugin.

Solutions

  1. Clear template cache: Clear the template cache to see if it resolves the issue.
  2. Disable plugins: Disable the Formie plugin and other plugins to see if it resolves the issue.
  3. Check database configuration: Check the database configuration to ensure that it is correctly configured.
  4. Check plugin configuration: Check the plugin configuration to ensure that it is correctly configured.
  5. Upgrade Craft CMS: Upgrade Craft CMS to the latest version to see if it resolves the issue.

Conclusion

The issue is causing intermittent outages on the website, and it can only be resolved by restarting the instance entirely to kill anything in the PHP process. The possible causes are a template caching issue, a plugin conflict, or a database issue. The solutions are to clear the template cache, disable plugins, check the database configuration, check the plugin configuration, or upgrade Craft CMS.
[5.x]: PHP process spiking with Unable to find template "x" error - Q&A

Q: What is the cause of the Unable to find template "x" error?

A: The error is caused by a problem with the template caching in Craft CMS. This could be due to a misconfigured template cache or a conflict with another plugin.

Q: How can I resolve the Unable to find template "x" error?

A: To resolve the error, you can try the following:

  1. Clear template cache: Clear the template cache to see if it resolves the issue.
  2. Disable plugins: Disable the Formie plugin and other plugins to see if it resolves the issue.
  3. Check database configuration: Check the database configuration to ensure that it is correctly configured.
  4. Check plugin configuration: Check the plugin configuration to ensure that it is correctly configured.
  5. Upgrade Craft CMS: Upgrade Craft CMS to the latest version to see if it resolves the issue.

Q: What are the possible causes of the Unable to find template "x" error?

A: The possible causes of the error are:

  1. Template caching issue: The error message suggests that there is a problem with the template caching.
  2. Plugin conflict: The error message suggests that there is a conflict between the Formie plugin and the Craft CMS vendor.
  3. Database issue: The error message suggests that there is a problem with the database.

Q: How can I prevent the Unable to find template "x" error from occurring in the future?

A: To prevent the error from occurring in the future, you can try the following:

  1. Regularly clear template cache: Regularly clear the template cache to ensure that it is up-to-date.
  2. Monitor plugin conflicts: Monitor plugin conflicts to ensure that they are not causing issues.
  3. Check database configuration: Regularly check the database configuration to ensure that it is correctly configured.
  4. Upgrade Craft CMS: Regularly upgrade Craft CMS to the latest version to ensure that you have the latest features and security patches.

Q: What are the symptoms of the Unable to find template "x" error?

A: The symptoms of the error are:

  1. Intermittent outages: The website may experience intermittent outages due to the error.
  2. PHP process spike: The PHP process may spike due to the error.
  3. Fatal error: A fatal error may occur due to the error.

Q: How can I troubleshoot the Unable to find template "x" error?

A: To troubleshoot the error, you can try the following:

  1. Check error logs: Check the error logs to see if there are any error messages related to the issue.
  2. Check plugin logs: Check the plugin logs to see if there are any error messages related to the issue.
  3. Check database logs: Check the database logs to see if there are any error messages related to the issue.
  4. Use debugging tools: Use debugging tools to see if there are any issues with the code.

Q: What are the consequences of the Unable to find template "x" error?

A: The consequences of the error are:

  1. Intermittent outages: The website may experience intermittent outages due to the.
  2. Data loss: Data may be lost due to the error.
  3. Security risks: Security risks may occur due to the error.

Q: How can I prevent data loss due to the Unable to find template "x" error?

A: To prevent data loss due to the error, you can try the following:

  1. Regularly backup data: Regularly backup data to ensure that it is safe.
  2. Use version control: Use version control to ensure that changes are tracked.
  3. Monitor database logs: Monitor database logs to ensure that there are no issues.
  4. Use debugging tools: Use debugging tools to see if there are any issues with the code.