PDOException (1049)
SQLSTATE[HY000] [1049] Unknown database 'sense_taku' PDOException thrown with message "SQLSTATE[HY000] [1049] Unknown database 'sense_taku'" Stacktrace: #5 PDOException in /var/www/html/site/functions.php:215 #4 PDO:__construct in /var/www/html/site/functions.php:215 #3 SenseGetPdo in /var/www/html/site/functions.php:279 #2 SensePostBootConfig in /var/www/html/site/config.php:103 #1 require in /var/www/vendor/processwire/processwire/wire/core/ProcessWire.php:1270 #0 ProcessWire\ProcessWire:buildConfig in /var/www/html/index.php:35
Stack frames (6)
5
PDOException
/html/site/functions.php215
4
PDO __construct
/html/site/functions.php215
3
SenseGetPdo
/html/site/functions.php279
2
SensePostBootConfig
/html/site/config.php103
1
require
/vendor/processwire/processwire/wire/core/ProcessWire.php1270
0
ProcessWire\ProcessWire buildConfig
/html/index.php35
/var/www/html/site/functions.php
 
function SenseGetInstance() {
  if(getenv('SENSE_INSTANCE')) {
    $instance = getenv('SENSE_INSTANCE');
  } elseif(!isset($_SERVER['HTTP_HOST'])) {
    throw new Exception('HTTP_HOST is not available and SENSE_INSTANCE is undefined');
  } else {
    $host = $_SERVER['HTTP_HOST'];
    if(!preg_match('|[a-z]+|i', $host)) {
      // Then it's probably just an ELB health check
      exit("OK");
    }
    list($instance,) = explode('.', $host);
  }
  return $instance;
}
 
function SenseGetPdo($config): PDO
{
  return new PDO("mysql:dbname=".$config->dbName.";host=".$config->dbHost.";port=".$config->dbPort.";charset=utf8", $config->dbUser, $config->dbPass);
}
 
// This function is called right before $wire is created and after ProcessWireBootConfig()
function SensePostBootConfig($config) {
  // Setup Whoops only for HTTP requests
  if(isset($_SERVER['HTTP_HOST'])) {
    if(getenv('SENSE_MODE') === 'dev') {
      // Enabled for dev
      senseSetupWhoops($config);
    } elseif(strpos($_SERVER['REQUEST_URI'],'/processwire') === 0) {
      // Always use Whoops for admin
      senseSetupWhoops($config);
    }
  }
 
  // PW's session init during tests causes errors, allow disabling
  if(getenv('SENSE_DISABLE_PW_SESSIONS') === '1') {
    $config->sessionAllow = false;
  }
  
/var/www/html/site/functions.php
 
function SenseGetInstance() {
  if(getenv('SENSE_INSTANCE')) {
    $instance = getenv('SENSE_INSTANCE');
  } elseif(!isset($_SERVER['HTTP_HOST'])) {
    throw new Exception('HTTP_HOST is not available and SENSE_INSTANCE is undefined');
  } else {
    $host = $_SERVER['HTTP_HOST'];
    if(!preg_match('|[a-z]+|i', $host)) {
      // Then it's probably just an ELB health check
      exit("OK");
    }
    list($instance,) = explode('.', $host);
  }
  return $instance;
}
 
function SenseGetPdo($config): PDO
{
  return new PDO("mysql:dbname=".$config->dbName.";host=".$config->dbHost.";port=".$config->dbPort.";charset=utf8", $config->dbUser, $config->dbPass);
}
 
// This function is called right before $wire is created and after ProcessWireBootConfig()
function SensePostBootConfig($config) {
  // Setup Whoops only for HTTP requests
  if(isset($_SERVER['HTTP_HOST'])) {
    if(getenv('SENSE_MODE') === 'dev') {
      // Enabled for dev
      senseSetupWhoops($config);
    } elseif(strpos($_SERVER['REQUEST_URI'],'/processwire') === 0) {
      // Always use Whoops for admin
      senseSetupWhoops($config);
    }
  }
 
  // PW's session init during tests causes errors, allow disabling
  if(getenv('SENSE_DISABLE_PW_SESSIONS') === '1') {
    $config->sessionAllow = false;
  }
  
/var/www/html/site/functions.php
    if(!file_exists($config->paths->$key)) {
      @mkdir($config->paths->$key);
    }
  }
 
  // Added to support local dev envs
  $config->paths->sessions = $config->paths->assets . "sessions/";
  if(!file_exists($config->paths->sessions)) {
    @mkdir($config->paths->sessions);
  }
  if(ini_get('session.save_handler') == 'files') {
    ini_set('session.save_path', $config->paths->sessions);
  }
 
  // TODO: Solve this some other way, at some point. This is currently done like this because
  // we needed a cloud-compatible way of preparing these. These are not sensitive information
  // so we could safely cache these using tedivm/stash for an example
 
  // Setup our own PDO to the database - PW has not yet setup it's own database connection
  $pdo = SenseGetPdo($config);
 
  // PW defaults
  $templateIDs = [3];
  $parentIDs = [29];
 
  // Fetch the entities directly from sensesettings
  // NOTE: During setup, this table does not exist. This is silently handled by
  //       a try/catch block in SensePdoGetValue
  $query = "SELECT value FROM sensesettings WHERE keyname='ui.login.entities' AND user='global'";
  $entities = SenseMultiSplit(SensePdoGetValue($pdo, $query, null, false));
  foreach($entities as $entity) {
    $query = "SELECT id FROM templates WHERE name=?";
    $templateIDs[] = SensePdoGetValue($pdo, $query, $entity);
 
    // Needed so we can find out the parent holding the entities
    $query = "SELECT id FROM templates WHERE name=?";
    $containerID = SensePdoGetValue($pdo, $query, $entity . '_container');
 
    $query = "SELECT id FROM pages WHERE templates_id=?";
    $parentIDs[] = SensePdoGetValue($pdo, $query, $containerID);
/var/www/html/site/config.php
  $config->senseCoreRoot . 'Other/',
  $config->senseCoreRoot . 'Process/',
  $config->senseCoreRoot . 'Service/',
  $config->senseCoreRoot . 'Service/DeliveryEngine/Submodules/',
  $config->senseCoreRoot . 'Service/ExportEngine/Submodules/',
  $config->senseCoreRoot . 'Service/FetchEngine/Submodules/',
  $config->senseCoreRoot . 'Service/TransformationEngine/Submodules/',
];
 
// Since we make a POST from tunnistus.avoine.fi, without this, the browser
// doesn't send the session cookie and you cannot login. This happens only
// with the js-forms + SSO -combo, so hopefully we can remove this some day.
//
// We also need to condition this because browsers require secure
if(getenv("SENSE_MODE") !== 'dev') {
  $config->sessionCookieSameSite = 'None';
}
 
// $config->httpHosts = [];
SensePostBootConfig($config);
 
/var/www/vendor/processwire/processwire/wire/core/ProcessWire.php
        $cfg['styles'] = new FilenameArray();
        $cfg['scripts'] = new FilenameArray();
        
        $config = new Config();
        $config->setTrackChanges(false);
        $config->data($cfg, true);
 
        // Include system config defaults
        /** @noinspection PhpIncludeInspection */
        require("$rootPath/$wireDir/config.php");
 
        // Include site-specific config settings
        $configFile = $sitePath . "config.php";
        $configFileDev = $sitePath . "config-dev.php";
        if(is_file($configFileDev)) {
            /** @noinspection PhpIncludeInspection */
            @require($configFileDev);
        } else if(is_file($configFile)) {
            /** @noinspection PhpIncludeInspection */
            @require($configFile);
        }
        
        if($httpHost) {
            $config->httpHost = $httpHost;
            if(!in_array($httpHost, $config->httpHosts)) $config->httpHosts[] = $httpHost;
        }
        
        if($scheme) $config->https = ($scheme === 'https'); 
        
        return $config;
    }
 
}
 
/var/www/html/index.php
 * @version 3.0
 *
 * Index Versions
 * ==============
 * 300 Moved much of this file to a ProcessWire::buildConfig() method.
 * 252 Extract all fuel to local API vars when in external or cli mode.
 * 251 Add $config->debugIf option.
 * 250 PW 2.5 support.
 *
 */
 
if(!defined("PROCESSWIRE")) define("PROCESSWIRE", 300); // index version
$rootPath = __DIR__;
if(DIRECTORY_SEPARATOR != '/') $rootPath = str_replace(DIRECTORY_SEPARATOR, '/', $rootPath);
# $composerAutoloader = $rootPath . '/vendor/autoload.php'; // composer autoloader
# if(file_exists($composerAutoloader)) require_once($composerAutoloader);
# if(!class_exists("ProcessWire\\ProcessWire", false)) require_once("$rootPath/wire/core/ProcessWire.php");
require $rootPath . '/../vendor/autoload.php';
 
$config = ProcessWire::buildConfig($rootPath);
 
if(!$config->dbName) {
    // If ProcessWire is not installed, go to the installer
    if(is_file("./install.php") && strtolower($_SERVER['REQUEST_URI']) == strtolower($config->urls->root)) {
        require("./install.php");
        exit(0);
    } else {
        header("HTTP/1.1 404 Page Not Found");
        echo "404 page not found (no site configuration or install.php available)";
        exit(0);
    }
}
 
$process = null;
$wire = null;
 
try { 
    // Bootstrap ProcessWire's core and make the API available with $wire
    // NOTE: Currently loading our own bootstrap wrapper
    require_once __DIR__ . '/AvoineProcessWire.php';

Environment & details:

empty
empty
empty
empty
empty
empty
Key Value
proto http
HTTP_MOD_REWRITE On
HTTP_X_FORWARDED_FOR 3.235.75.229
HTTP_X_FORWARDED_PROTO https
HTTP_X_FORWARDED_PORT 443
HTTP_HOST taku.staging.sensereg.com
HTTP_X_AMZN_TRACE_ID Root=1-66058dd6-2773aeed65122519486b3118
HTTP_ACCEPT */*
HTTP_USER_AGENT claudebot
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SERVER_SIGNATURE <address>Apache/2.4.57 (Debian) Server at taku.staging.sensereg.com Port 80</address>
SERVER_SOFTWARE Apache/2.4.57 (Debian)
SERVER_NAME taku.staging.sensereg.com
SERVER_ADDR 172.20.45.169
SERVER_PORT 80
REMOTE_ADDR 172.20.39.62
DOCUMENT_ROOT /var/www/html
REQUEST_SCHEME http
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT /var/www/html
SERVER_ADMIN webmaster@localhost
SCRIPT_FILENAME /var/www/html/index.php
REMOTE_PORT 33636
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET
QUERY_STRING
REQUEST_URI /
SCRIPT_NAME /index.php
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711640022.9241
REQUEST_TIME 1711640022
empty
0. Avoine\SenseWhoopsHandler