Add a setting which would disable redirecting live sites to /core/install.php in every cases and fail with an error instead

Created on 1 August 2024, 4 months ago

Problem/Motivation

We're experiencing that sometimes when the traffic gets really high and more connections are present on the server, core redirects pages to /core/install.php Visitors are greeted with the Drupal install page or "Drupal is already installed" page. And since this install page returns HTTP 200 OK, this also means this page could be cached by reverse proxy caches and uptime metrics are also thinking the site works and not reporting that the site is down.

According to the error log, in these cases where we experience this redirect, it is always a problem with database connections:

2024/08/01 04:51:45 [error] 903604#903604: *41431660 FastCGI sent in stderr: "PHP message: PDOException: SQLSTATE[HY000] [2006] MySQL server has gone away in /home/web/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php on line 79 #0 /home/web/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php(416): PDO->__construct()
#1 /home/web/core/lib/Drupal/Core/Database/Database.php(371): Drupal\Core\Database\Driver\mysql\Connection::open()
#2 /home/web/core/lib/Drupal/Core/Database/Database.php(166): Drupal\Core\Database\Database::openConnection()
#3 [internal function]: Drupal\Core\Database\Database::getConnection()
#4 /home/web/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(79): call_user_func_array()
#5 /home/web/core/lib/Drupal/Component/DependencyInjection/Container.php(173): Drupal\Component\DependencyInjection\PhpArrayContainer->createService()
#6 /home/web/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(265): Drupal\Component\Dep" while reading response header from upstream, client: 127.0.0.1

2024/08/01 04:51:45 [error] 903604#903604: *41431645 FastCGI sent in stderr: "PHP message: PDOException: SQLSTATE[HY000] [2002] Connection refused in /home/web/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php on line 79 #0 /home/web/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php(416): PDO->__construct()
#1 /home/web/core/lib/Drupal/Core/Database/Database.php(374): Drupal\Core\Database\Driver\mysql\Connection::open()
#2 /home/web/core/lib/Drupal/Core/Database/Database.php(169): Drupal\Core\Database\Database::openConnection()
#3 [internal function]: Drupal\Core\Database\Database::getConnection()
#4 /home/web/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(79): call_user_func_array()
#5 /home/web/core/lib/Drupal/Component/DependencyInjection/Container.php(173): Drupal\Component\DependencyInjection\PhpArrayContainer->createService()
#6 /home/web/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(212): Drupal\Component\DependencyInjectio" while reading response header from upstream, client: 127.0.0.1

2024/08/01 04:51:45 [error] 903601#903601: *41431625 FastCGI sent in stderr: "PHP message: Failed to log error: PDOException: SQLSTATE[HY000] [2002] Connection refused in Drupal\dblog\Logger\DbLog->log() (line 101 of /home/web/core/modules/dblog/src/Logger/DbLog.php). #0 /home/web/core/modules/mysql/src/Driver/Database/mysql/Connection.php(189): PDO->__construct()
#1 /home/web/core/lib/Drupal/Core/Database/Database.php(463): Drupal\mysql\Driver\Database\mysql\Connection::open()
#2 /home/web/core/lib/Drupal/Core/Database/Database.php(188): Drupal\Core\Database\Database::openConnection()
#3 /home/web/core/modules/dblog/src/Logger/DbLog.php(101): Drupal\Core\Database\Database::getConnection()
#4 /home/web/core/lib/Drupal/Core/Logger/LoggerChannel.php(127): Drupal\dblog\Logger\DbLog->log()
#5 /home/web/core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php(70): Drupal\Core\Logger\LoggerChannel->log()
#6 /home/web/core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php(97): Drupal\Core\EventSubscriber\ExceptionLogg...PHP message: PDOException: SQLSTATE[HY000] [2002] Connection refused in /home/web/core/modules/dblog/src/Logger/DbLog.php on line 101 #0 /home/web/core/modules/mysql/src/Driver/Database/mysql/Connection.php(189): PDO->__construct()
#1 /home/web/core/lib/Drupal/Core/Database/Database.php(463): Drupal\mysql\Driver\Database\mysql\Connection::open()
#2 /home/web/core/lib/Drupal/Core/Database/Database.php(188): Drupal\Core\Database\Database::openConnection()
#3 /home/web/core/modules/dblog/src/Logger/DbLog.php(101): Drupal\Core\Database\Database::getConnection()
#4 /home/web/core/lib/Drupal/Core/Logger/LoggerChannel.php(127): Drupal\dblog\Logger\DbLog->log()
#5 /home/web/core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php(70): Drupal\Core\Logger\LoggerChannel->log()
#6 /home/web/core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php(97): Drupal\Core\EventSubscriber\ExceptionLog

Steps to reproduce

Proposed resolution

For deployed and live sites it would make sense to never redirect to install.php ever, the best option would be introducing a setting in settings.php and if that is true, then instead of redirecting, core should throw an HTTP 500 error with WSOD instead if there's a problem with the database connection or something is missing from the database.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component
Request processingΒ  β†’

Last updated about 6 hours ago

No maintainer
Created by

πŸ‡ΈπŸ‡°Slovakia kaszarobert

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024