Phalcon Framework 1.3.5

PDOException: SQLSTATE[HY000] [2002] No such file or directory

/var/www/vhosts/sites-master/bootstrap.php (54)
#0PDO->__construct(mysql:adapter=Mysql;host=localhost;dbname=dewa;charset=utf8, dewa, dewa, Array([3] => 2))
#1Phalcon\Db\Adapter\Pdo->connect(Array([adapter] => Mysql, [host] => localhost, [username] => dewa, [password] => dewa, [dbname] => dewa, [charset] => utf8))
#2Phalcon\Db\Adapter\Pdo->__construct(Array([adapter] => Mysql, [host] => localhost, [username] => dewa, [password] => dewa, [dbname] => dewa, [charset] => utf8))
<?php
use \Kotarosoft\Mail;
use \Kotarosoft\Tag;
use \Kotarosoft\AssetsManager;
use \Phalcon\Logger as Logger;
use \Phalcon\Logger\Adapter\File as LoggerAdapter;
use \Phalcon\Mvc\Dispatcher as Dispatcher;
use \Phalcon\Session\Adapter\Files as SessionAdapter;
 
$loader = new \Phalcon\Loader();
$loader->registerDirs(
    array(
        $config->application->controllersDir,
        $config->application->modelsDir,
        $config->application->libraryDir,
    )
)->register();
 
$di = new \Phalcon\DI\FactoryDefault();
$config->merge($theme_config);
$di->setShared('config', $config);
 
$di->setShared('url', function () use ($config) {
    $url = new \Phalcon\Mvc\Url();
    $url->setBaseUri($config->application->baseUri);
    if (strpos($_SERVER['SERVER_NAME'], 'preview') === false) {
        $url->setBaseUri('/');
    } else {
        $url->setBaseUri($config->application->baseUri);
    }
    return $url;
});
 
$di->setShared('view', function () use ($config) {
    $view = new \Phalcon\Mvc\View();
    $view->setViewsDir($config->application->viewsDir);
    $view->registerEngines(array(
        '.volt' => function ($view, $di) use ($config) {
            $volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
            $volt->setOptions(array(
                'compiledPath' => $config->application->cacheDir,
                'compiledSeparator' => '_',
                'compileAlways' => $config->application->debug,
            ));
            require $config->application->voltFile;
            return $volt;
        },
    ));
 
    return $view;
});
 
$di->setShared('db', function () use ($config) {
    $connection = new \Phalcon\Db\Adapter\Pdo\Mysql((array) $config->database);
    if ($config->application->debugSql == true) {
        $eventsManager = new \Phalcon\Events\Manager();
        $logger = new LoggerAdapter($config->application->logFile);
        $formatter = new \Phalcon\Logger\Formatter\Line("%date% [%type%] %message%", 'Y-m-d H:i:s');
        $logger->setFormatter($formatter);
 
        $eventsManager->attach('db', function ($event, $connection) use ($logger) {
            if ($event->getType() == 'beforeQuery') {
                $logger->log($connection->getSQLStatement(), Logger::INFO);
            }
        });
        $connection->setEventsManager($eventsManager);
    }
 
    return $connection;
});
 
$di->setShared('modelsMetadata', function () use ($config) {
    return new \Phalcon\Mvc\Model\Metadata\Memory();
});
 
$di->setShared('session', function () {
    $session = new SessionAdapter();
    $session->start();
    return $session;
});
 
$di->setShared('crypt', function () use ($config) {
    $crypt = new \Phalcon\Crypt();
    $crypt->setKey($config->application->cryptSalt);
    return $crypt;
});
 
//http://forum.phalconphp.com/discussion/215/flash-css-classes-not-working-for-me
$di->setShared('flash', function () {
    return new \Phalcon\Flash\Session(array(
        'error' => 'alert alert-danger alert-dismissable',
        'success' => 'alert alert-success alert-dismissable',
        'notice' => 'alert alert-info alert-dismissable',
    ));
});
 
$di->setShared('dispatcher', function () {
    $dispatcher = new Dispatcher();
    return $dispatcher;
});
 
$di->setShared('router', function () use ($config) {
    $router = new \Phalcon\Mvc\Router(false);
    $router->removeExtraSlashes(true);
    require $config->application->routeFile;
 
    // some default settings
    $router->add('/rss.xml', array('controller' => 'rss', 'action' => 'index'));
    $router->add('/sendmail', array('controller' => 'contacts', 'action' => 'send'));
    $router->add('/', array('controller' => 'index', 'action' => 'index'));
    $router->notFound(array('controller' => 'index', 'action' => 'route404'));
    return $router;
});
 
$di->setShared('mail', function () use ($config) {
    return new Mail($config);
});
 
$di->setShared('tag', function () use ($config) {
    return new Tag($config);
});
 
$di->setShared('assets', function () use ($config) {
    $assets = new AssetsManager($config);
    return $assets;
});
#3{closure}()
#4Phalcon\DI\Service->resolve(null, Object(Phalcon\DI\FactoryDefault))
#5Phalcon\DI->getShared(db)
#6Phalcon\Mvc\Model\Manager->getReadConnection(Object(Users: 60))
#7Phalcon\Mvc\Model->getReadConnection()
#8Phalcon\Mvc\Model\MetaData\Strategy\Introspection->getMetaData(Object(Users: 60), Object(Phalcon\DI\FactoryDefault))
#9Phalcon\Mvc\Model\MetaData->_initialize(Object(Users: 60), users-users, users, null)
#10Phalcon\Mvc\Model\MetaData->readMetaDataIndex(Object(Users: 60), 1)
#11Phalcon\Mvc\Model\MetaData->getPrimaryKeyAttributes(Object(Users: 60))
#12Phalcon\Mvc\Model\Query\Builder->getPhql()
#13Phalcon\Mvc\Model\Query\Builder->getQuery()
#14Phalcon\Mvc\Model::findFirst(133)
<?php
 
error_reporting(E_ALL);
 
$debug = new \Phalcon\Debug();
$debug->listen();
 
//try {
    $path = dirname(__FILE__);
    $paths = explode(DIRECTORY_SEPARATOR, $path);
    $env = $paths[2];
 
    include '../site.php';
    $config = include '/var/' . $env . '/vhosts/sites-master/config.php';
    $theme_config = include '/var/' . $env . '/themes/themes-available/' . $theme . '/config/config.php';
    include '/var/' . $env . '/vhosts/sites-master/bootstrap.php';
 
    $application = new \Phalcon\Mvc\Application($di);
    $user = Users::findFirst($config->application->userkey);
    if ($user->active == 0 && strpos($_SERVER['HTTP_HOST'], "preview.") === false) {
        echo "このサイトは現在、メンテナンス中です。";
    } else {
        echo $application->handle()->getContent();
    }
 
/*
} catch (\Exception $e) {
  echo $e->getMessage();
}
*/
KeyValue
_url/blog
archive201910
KeyValue
USERnginx
HOME/var/cache/nginx
FCGI_ROLERESPONDER
QUERY_STRING_url=/blog&archive=201910
REQUEST_METHODGET
CONTENT_TYPE
CONTENT_LENGTH
SCRIPT_NAME/index.php
REQUEST_URI/blog?archive=201910
DOCUMENT_URI/index.php
DOCUMENT_ROOT/var/www/vhosts/sites-available/hope-jpn.com/public
SERVER_PROTOCOLHTTP/1.1
REQUEST_SCHEMEhttp
GATEWAY_INTERFACECGI/1.1
SERVER_SOFTWAREnginx/1.14.0
REMOTE_ADDR3.95.131.208
REMOTE_PORT34446
SERVER_ADDR133.242.182.28
SERVER_PORT80
SERVER_NAMEwww.hope-jpn.com
HTTP_UACCBot/2.0 (https://commoncrawl.org/faq/)
REDIRECT_STATUS200
PATH_INFO
PATH_TRANSLATED/var/www/vhosts/sites-available/hope-jpn.com/public
SCRIPT_FILENAME/var/www/vhosts/sites-available/hope-jpn.com/public/index.php
HTTP_USER_AGENTCCBot/2.0 (https://commoncrawl.org/faq/)
HTTP_ACCEPTtext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_LANGUAGEen-US,en;q=0.5
HTTP_IF_MODIFIED_SINCEThu, 17 Oct 2019 15:46:46 UTC
HTTP_HOSTwww.hope-jpn.com
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip
PHP_SELF/index.php
REQUEST_TIME_FLOAT1576115287.6439
REQUEST_TIME1576115287
#Path
0/var/www/vhosts/sites-master/index.php
1/var/www/vhosts/sites-available/hope-jpn.com/site.php
2/var/www/vhosts/sites-master/config.php
3/var/www/themes/themes-available/template8/config/config.php
4/var/www/vhosts/sites-master/bootstrap.php
5/var/www/htdocs/app/models/Users.php
6/var/www/htdocs/app/models/BaseModel.php
Memory
Usage786432