Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

"Script Encountered an Error — Enable This Feature in .settings.php"

3 min read
08.11.2025

The error message "The script encountered an error and will be aborted. To view extended error messages, enable this feature in .settings.php." suggests that the application encountered a problem, but detailed error information is hidden. To debug the issue, you will need to enable error reporting in the .settings.php file or the equivalent configuration file for your application.

Script Error Settings.php Drupal
Drupal — flip error_level in settings.php, reproduce, flip back.

For closely related Drupal / CMS-debug topics, see CVE-2014-3704 — Drupalgeddon Patch, Bitrix Error Log — Locate, Enable, Analyze, and Enable PHP Error Reporting for mysql.php.

Locate the .settings.php File

  • The .settings.php file is typically found in the root directory or configuration directory of your application.
  • If the application documentation specifies a different configuration file for error reporting, locate and open that file instead.
Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

Enable Error Reporting

In the .settings.php file, look for a line or configuration related to error reporting or debug mode. Examples might include:

Example 1: Enable Debugging

define('DEBUG_MODE', true);

Example 2: Enable Extended Error Messages

Change:

$show_extended_errors = false;

To:

$show_extended_errors = true;

Example 3: Adjust Error Reporting Settings

Look for error reporting settings and modify them:

ini_set('display_errors', 1);
error_reporting(E_ALL);

Check PHP Error Reporting Configuration

If .settings.php does not contain error reporting settings or does not exist, you can enable error reporting directly in your PHP script or globally.

Enable Error Reporting in PHP Scripts

Add this at the beginning of your PHP file:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

Enable Error Logging

If you do not want to display errors publicly, enable error logging:

ini_set('log_errors', 1);
ini_set('error_log', '/path/to/php-error.log');

Reproduce the Issue

Once error reporting is enabled:

  1. Reload the page or rerun the script to reproduce the issue.
  2. Look for detailed error messages on the screen or in the error log file.

Debug the Error

Use the detailed error message to identify and resolve the issue. Common causes include:

  • Syntax errors in the script.
  • Missing or incorrect database configuration.
  • Missing files or incorrect file permissions.
  • Deprecated or incompatible PHP functions.

Disable Error Reporting in Production

Once the issue is resolved, disable error reporting to prevent exposing sensitive information in a production environment.

Modify .settings.php

Change the error reporting setting back to its original value:

$show_extended_errors = false;

In PHP Scripts

Disable error reporting:

ini_set('display_errors', 0);
error_reporting(0);

Example Debugging Configuration

Here is an example .settings.php file for enabling debugging:

<?php

// Enable debugging

define('DEBUG_MODE', true);



// Enable extended error messages

$show_extended_errors = true;



// Set PHP error reporting

ini_set('display_errors', 1);

ini_set('display_startup_errors', 1);

error_reporting(E_ALL);

?>

Common Issues and Fixes

Issue Fix
Database Connection Error Check database credentials in configuration files.
Missing Files Ensure all required files are present and have correct permissions.
Deprecated PHP Functions Update the code to replace deprecated functions with supported alternatives.
File Permissions Issue Set correct permissions (e.g., chmod 644 for files and chmod 755 for directories).
Syntax Error Review the script for missing semicolons or unmatched braces.

Next Steps

  1. Enable error reporting as described above.
  2. Review the detailed error messages to identify the root cause.
  3. Resolve the issue based on the error details.
  4. Disable error reporting after debugging is complete.
Frequently asked questions
Drupal 8/9/10: `sites/default/settings.php`, look for `$config['system.logging']['error_level']`. Set to `'verbose'` for full backtrace, `'all'` for displayed errors. Drupal 7: `$conf['error_level'] = 2;` at the bottom of settings.php. After change, clear cache: `drush cr` (D8+) or `drush cc all` (D7).
Drupal cached the rendered error page before you changed the setting. `drush cr` to invalidate cache, then reload. If still blank, check `/var/log/apache2/error.log` and Drupal's watchdog (`drush ws --count=20`) — the error may be at the PHP-fatal layer, before Drupal's error display applies. Apache log is authoritative for those.
Drupal sets settings.php read-only (chmod 444) as a security measure once installed. To edit, `chmod 644 sites/default/settings.php`, make your change, restore `chmod 444`. Don't leave it writable — a webshell that can write settings.php can rewrite DB credentials and own your database.
Two options: (1) restrict by IP — wrap the error_level switch in `if ($_SERVER['REMOTE_ADDR'] === 'YOUR_IP') { ... }` in settings.php so only you see verbose. (2) Don't change error_level; rely on Drupal's watchdog logs (`drush ws`) which capture errors without displaying. Production should never have `error_level = 'verbose'` unconditionally.
Related articles
Fixing "A Fatal Error or Timeout Occurred While Processing This Directive"
max_input_vars in Bitrix: What It Is and How to Adjust It
Enable PHP Error Reporting for engine/classes/mysql.php Troubleshooting