function DrupalKernel::bootEnvironment
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::bootEnvironment()
- 10 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::bootEnvironment()
- 9 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::bootEnvironment()
- 8.9.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::bootEnvironment()
Setup a consistent PHP environment.
This method sets PHP environment options we want to be sure are set correctly for security or just saneness.
Parameters
string $app_root: (optional) The path to the application root as a string. If not supplied, the application root will be computed.
5 calls to DrupalKernel::bootEnvironment()
- CacheRebuildCommand::__invoke in core/
lib/ Drupal/ Core/ Command/ CacheRebuildCommand.php - Rebuild all caches.
- DrupalKernel::createFromRequest in core/
lib/ Drupal/ Core/ DrupalKernel.php - Create a DrupalKernel object from a request.
- DrupalKernel::handle in core/
lib/ Drupal/ Core/ DrupalKernel.php - rebuild.php in core/
rebuild.php - Rebuilds all Drupal caches even when Drupal itself does not work.
- UpdateKernel::handle in core/
lib/ Drupal/ Core/ Update/ UpdateKernel.php
File
-
core/
lib/ Drupal/ Core/ DrupalKernel.php, line 1131
Class
- DrupalKernel
- The DrupalKernel class is the core of Drupal itself.
Namespace
Drupal\CoreCode
public static function bootEnvironment($app_root = NULL) {
if (static::$isEnvironmentInitialized) {
return;
}
// Determine the application root if it's not supplied.
if ($app_root === NULL) {
$app_root = static::guessApplicationRoot();
}
error_reporting(E_ALL);
// Override PHP settings required for Drupal to work properly.
// sites/default/default.settings.php contains more runtime settings.
// The .htaccess file contains settings that cannot be changed at runtime.
if (PHP_SAPI !== 'cli') {
// Use session cookies, not transparent sessions that puts the session id
// in the query string.
ini_set('session.use_cookies', '1');
ini_set('session.use_strict_mode', '1');
// Don't send HTTP headers using PHP's session handler.
// Send an empty string to disable the cache limiter.
ini_set('session.cache_limiter', '');
// Use httponly session cookies.
ini_set('session.cookie_httponly', '1');
}
// Set sane locale settings, to ensure consistent string, dates, times and
// numbers handling.
setlocale(LC_ALL, 'C.UTF-8', 'C');
// Set appropriate configuration for multi-byte strings.
mb_internal_encoding('utf-8');
mb_language('uni');
// Set DRUPAL_TEST_IN_CHILD_SITE if we're inside a test.
static::setupDrupalTestInChildSite($app_root);
// Set the Drupal custom error handler.
set_error_handler('_drupal_error_handler');
set_exception_handler('_drupal_exception_handler');
static::$isEnvironmentInitialized = TRUE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.