PDOException: SQLSTATE[HY000] [2005] Unknown MySQL server host 'fundipal.com' (-2)
/home/wittig/demo/fundipal/app/library/App/Bootstrap/ServiceBootstrap.php (31)
#0PDO->__construct(mysql:host=fundipal.com;dbname=fundipal_dkdraft;charset=utf8, fundipal_main, DDWTcsIUGU, Array(3 => 2))
#1Phalcon\Db\Adapter\Pdo->connect(Array(host => fundipal.com, username => fundipal_main, password => DDWTcsIUGU, dbname => fundipal_dkdraft, charset => utf8))
#2Phalcon\Db\Adapter\Pdo->__construct(Array(host => fundipal.com, username => fundipal_main, password => DDWTcsIUGU, dbname => fundipal_dkdraft, charset => utf8))
/home/wittig/demo/fundipal/app/library/App/Bootstrap/ServiceBootstrap.php (31)
<?php
 
namespace App\Bootstrap;
 
use App\Services\AssetsManager;
use App\Services\MailService;
use Phalcon\Config;
use Phalcon\Mvc\Application;
use Phalcon\DiInterface;
use App\BootstrapInterface;
use App\Constants\Services;
use Phalcon\Mvc\Dispatcher;
use Phalcon\Mvc\Url as UrlResolver;
use Phalcon\Mvc\View;
use Phalcon;
use Phalcon\Tag;
 
class ServiceBootstrap implements BootstrapInterface
{
    public function run(Application $api, DiInterface $di, Config $config)
    {
        $di->setShared(Services::CONFIG, $config);
 
        $di->set(Services::DB, function () use ($config, $di) {
 
            $config = $config->get('database')->toArray();
            $adapter = $config['adapter'];
            unset($config['adapter']);
            $class = 'Phalcon\Db\Adapter\Pdo\\' . $adapter;
 
            $connection = new $class($config);
 
            // Assign the eventsManager to the db adapter instance
            $connection->setEventsManager($di->get(Services::EVENTS_MANAGER));
 
            return $connection;
        });
 
        $di->set('crypt', function() {
            $crypt = new Phalcon\Crypt();
            $crypt->setKey('2291149821249852');
            return $crypt;
        });
 
        $di->set('cookies', function () {
            $cookies = new Phalcon\Http\Response\Cookies();
            $cookies->useEncryption(false);
            return $cookies;
        });
 
        $di->setShared(Services::DISPATCHER, function() use ($config, $di) {
 
            $eventsManager = $di->get(Services::EVENTS_MANAGER);
 
            // Attach a listener for errors, only in production
            if(!$config->debug){
 
                $errorHandler = new \App\Plugins\ErrorHandler($di);
                $eventsManager->attach('dispatch', $errorHandler);
            }
 
            $dispatcher = new Dispatcher();
            $dispatcher->setEventsManager($eventsManager);
 
            return $dispatcher;
        });
 
        $di->set(Services::URL, function () use ($config) {
 
            $url = new UrlResolver;
            $url->setBaseUri($config->get('application')->baseUri);
            $url->setStaticBaseUri($config->domain . '/');
 
            return $url;
        });
        
        $di->set(Services::ASSETS, function() {
            return new AssetsManager();
        });
 
        $di->set(Services::MAIL, function() {
            return new MailService();
        });
 
 
        $di->set(Services::VIEW, function () use ($config, $di) {
 
            $view = new View();
            $view->setViewsDir($config->application->viewsDir);
            $view->registerEngines([
                ".volt" => function($view, $di) use ($config) {
 
                    $volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
                    $volt->setOptions([
                        "compiledPath" => $config->application->voltCacheDir
                    ]);
                    return $volt;
                }
            ]);
 
            return $view;
        });
 
        $di->set(Services::SIMPLE_VIEW, function () use ($config, $di) {
 
            $view = new \Phalcon\Mvc\View\Simple();
 
            $voltEngine = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
            $voltEngine->setOptions([
                "compiledPath" => $config->application->voltCacheDir
            ]);
 
            $compiler = $voltEngine->getCompiler();
            $compiler->addFilter('number_format', 'number_format');
 
            $view->setViewsDir($config->application->viewsDir);
            $view->registerEngines([
                ".volt" => $voltEngine
            ]);
 
            return $view;
        });
    }
#3App\Bootstrap\ServiceBootstrap->App\Bootstrap\{closure}()
#4Phalcon\Di\Service->resolve(null, Object(Phalcon\Di\FactoryDefault))
#5Phalcon\Di->get(db, null)
#6Phalcon\Di->getShared(db)
#7Phalcon\Mvc\Model\Manager->_getConnection(Object(App\Model\Provider: 15), null)
#8Phalcon\Mvc\Model\Manager->getReadConnection(Object(App\Model\Provider: 15))
#9Phalcon\Mvc\Model->getReadConnection()
#10Phalcon\Mvc\Model\Query->getReadConnection(Object(App\Model\Provider: 15), Array(models => Array(0 => App\Model\Provider), tables => Array(0 => providers), columns => Array(app\Model\Provider => Array(type => object, model => App\Model\Provider, column => providers, balias => app\Model\Provider))), null, null)
#11Phalcon\Mvc\Model\Query->_executeSelect(Array(models => Array(0 => App\Model\Provider), tables => Array(0 => providers), columns => Array(app\Model\Provider => Array(type => object, model => App\Model\Provider, column => providers, balias => app\Model\Provider))), null, null)
#12Phalcon\Mvc\Model\Query->execute()
#13Phalcon\Mvc\Model::find()
/home/wittig/demo/fundipal/app/library/App/Mvc/Controller.php (81)
<?php
 
namespace App\Mvc;
 
use App\Constants\Services;
use App\Exception\NotFound;
use App\Model\Product;
use App\Model\ProductApplicationSpecification;
use App\Model\ProductCost;
use App\Model\ProductCostItem;
use App\Model\ProductLoanProperty;
use App\Model\ProductProperty;
use App\Model\ProviderProperty;
use App\Model\ProductApplicationQuestion;
use App\Model\FilterRules;
use App\Services\AssetsManager;
use Phalcon\Dispatcher;
use Phalcon\Events\Event;
use App\Model\Provider;
use Phalcon\Mvc\Model\Query;
 
/**
 * Class Controller
 * @package App\Mvc
 *
 * @property AssetsManager $assets
 */
 
class Controller extends \Phalcon\Mvc\Controller
{
    protected $checkData = null;
    protected $footerVisible = true;
 
    public function initialize()
    {
 
 
        $this->tag->setTitle("Fundipal");
        $this->assets->addJsInitModule('fundipal');
 
        $this->assets->addCss('css/website.css?v=3');
        $this->injectJSData();
        $this->view->menu = file_get_contents('../menu.html');
 
        $cookieValue = $this->cookies->get('FIRST_VIEW')->getValue();
        if(isset($cookieValue)){
            if(trim($cookieValue) == 'false'){
                //SECOND TIME VISITING SET COOKIE TO TRUE
                $this->cookies->set('FIRST_VIEW', 'true');
            }
 
        }
        else{
            //FIRST TIME VISITING SET THE COOKIE TO FALSE
            $this->cookies->set('FIRST_VIEW', 'false');
        }
    }
 
    public function afterExecuteRoute(Dispatcher $dispatcher)
    {
        $config = $this->getDI()->get(Services::CONFIG);
 
        if(!$this->view->isDisabled()) {
 
            $this->view->debugMode = $config->debug;
            $this->view->jsData = $this->assets->getJsData();
            $this->view->footerVisible = $this->footerVisible;
        }
 
        $this->response->setHeader('P3P', 'CP="CAO DSP COR CURa ADMa DEVa PSAa PSDa IVAi IVDi CONi OUR OTRi IND PHY ONL UNI FIN COM NAV INT DEM STA"');
 
    }
 
    protected function _throwNotFound(){
 
        throw new NotFound();
    }
 
    protected function injectJSData(){
 
        $providers = Provider::find()->toArray();
        $providerProperties = ProviderProperty::find()->toArray();
        $products = Product::find()->toArray();
        $productProperties = ProductProperty::find()->toArray();
        $productCosts = ProductCost::find()->toArray();
        $productCostsItems = ProductCostItem::find()->toArray();
        $productLoanProperties = ProductLoanProperty::find()->toArray();
        $productApplicationSpecifications = ProductApplicationSpecification::find()->toArray();
        $productApplicationQuestions = ProductApplicationQuestion::find()->toArray();
        $filterRules = filterRules::find()->toArray();
 
        $this->assets->setJsData("providers", $providers);
        $this->assets->setJsData("providerProperties", $providerProperties);
        $this->assets->setJsData("products", $products);
        $this->assets->setJsData("productProperties", $productProperties);
        $this->assets->setJsData("productCosts", $productCosts);
        $this->assets->setJsData("productCostsItems", $productCostsItems);
        $this->assets->setJsData("productLoanProperties", $productLoanProperties);
        $this->assets->setJsData("productApplicationSpecifications", $productApplicationSpecifications);
        $this->assets->setJsData("productApplicationQuestions", $productApplicationQuestions);
        $this->assets->setJsData("filterRules", $filterRules);
        $this->assets->setJsData('sessionSubmitUrl', $this->url->get('check/submit'));
        $this->assets->setJsData('applicationUrl', $this->url->get('check/apply'));
        $this->assets->setJsData('fileSubmitUrl', $this->url->get('check/upload'));
    }
#14App\Mvc\Controller->injectJSData()
/home/wittig/demo/fundipal/app/library/App/Mvc/Controller.php (42)
<?php
 
namespace App\Mvc;
 
use App\Constants\Services;
use App\Exception\NotFound;
use App\Model\Product;
use App\Model\ProductApplicationSpecification;
use App\Model\ProductCost;
use App\Model\ProductCostItem;
use App\Model\ProductLoanProperty;
use App\Model\ProductProperty;
use App\Model\ProviderProperty;
use App\Model\ProductApplicationQuestion;
use App\Model\FilterRules;
use App\Services\AssetsManager;
use Phalcon\Dispatcher;
use Phalcon\Events\Event;
use App\Model\Provider;
use Phalcon\Mvc\Model\Query;
 
/**
 * Class Controller
 * @package App\Mvc
 *
 * @property AssetsManager $assets
 */
 
class Controller extends \Phalcon\Mvc\Controller
{
    protected $checkData = null;
    protected $footerVisible = true;
 
    public function initialize()
    {
 
 
        $this->tag->setTitle("Fundipal");
        $this->assets->addJsInitModule('fundipal');
 
        $this->assets->addCss('css/website.css?v=3');
        $this->injectJSData();
        $this->view->menu = file_get_contents('../menu.html');
 
        $cookieValue = $this->cookies->get('FIRST_VIEW')->getValue();
        if(isset($cookieValue)){
            if(trim($cookieValue) == 'false'){
                //SECOND TIME VISITING SET COOKIE TO TRUE
                $this->cookies->set('FIRST_VIEW', 'true');
            }
 
        }
        else{
            //FIRST TIME VISITING SET THE COOKIE TO FALSE
            $this->cookies->set('FIRST_VIEW', 'false');
        }
    }
 
    public function afterExecuteRoute(Dispatcher $dispatcher)
    {
        $config = $this->getDI()->get(Services::CONFIG);
 
        if(!$this->view->isDisabled()) {
 
            $this->view->debugMode = $config->debug;
            $this->view->jsData = $this->assets->getJsData();
            $this->view->footerVisible = $this->footerVisible;
        }
 
        $this->response->setHeader('P3P', 'CP="CAO DSP COR CURa ADMa DEVa PSAa PSDa IVAi IVDi CONi OUR OTRi IND PHY ONL UNI FIN COM NAV INT DEM STA"');
 
    }
 
    protected function _throwNotFound(){
 
        throw new NotFound();
    }
 
    protected function injectJSData(){
 
        $providers = Provider::find()->toArray();
        $providerProperties = ProviderProperty::find()->toArray();
        $products = Product::find()->toArray();
        $productProperties = ProductProperty::find()->toArray();
        $productCosts = ProductCost::find()->toArray();
        $productCostsItems = ProductCostItem::find()->toArray();
        $productLoanProperties = ProductLoanProperty::find()->toArray();
        $productApplicationSpecifications = ProductApplicationSpecification::find()->toArray();
        $productApplicationQuestions = ProductApplicationQuestion::find()->toArray();
        $filterRules = filterRules::find()->toArray();
 
        $this->assets->setJsData("providers", $providers);
        $this->assets->setJsData("providerProperties", $providerProperties);
        $this->assets->setJsData("products", $products);
        $this->assets->setJsData("productProperties", $productProperties);
        $this->assets->setJsData("productCosts", $productCosts);
        $this->assets->setJsData("productCostsItems", $productCostsItems);
        $this->assets->setJsData("productLoanProperties", $productLoanProperties);
        $this->assets->setJsData("productApplicationSpecifications", $productApplicationSpecifications);
        $this->assets->setJsData("productApplicationQuestions", $productApplicationQuestions);
        $this->assets->setJsData("filterRules", $filterRules);
        $this->assets->setJsData('sessionSubmitUrl', $this->url->get('check/submit'));
        $this->assets->setJsData('applicationUrl', $this->url->get('check/apply'));
        $this->assets->setJsData('fileSubmitUrl', $this->url->get('check/upload'));
    }
#15App\Mvc\Controller->initialize()
#16Phalcon\Dispatcher->dispatch()
#17Phalcon\Mvc\Application->handle()
/home/wittig/demo/fundipal/public/index.php (70)
<?php
 
/** @var \Phalcon\Config $config */
$config = null;
 
/** @var \Phalcon\Mvc\Application $app */
$app = null;
 
/** @var \Phalcon\Http\Response $response */
$response = null;
 
try {
 
    define("ROOT_DIR", __DIR__ . '/..');
    define("APP_DIR", ROOT_DIR . '/app');
    define("VENDOR_DIR", ROOT_DIR . '/vendor');
    define("CONFIG_DIR", APP_DIR . '/configs');
 
    define('APPLICATION_ENV', getenv('APPLICATION_ENV') ?: 'development');
 
    // Autoload dependencies
    require VENDOR_DIR . '/autoload.php';
 
    $loader = new \Phalcon\Loader();
 
    $loader->registerNamespaces([
        'App' => APP_DIR . '/library/App',
        'Phalcon\Utils' => APP_DIR . '/library/Phalcon/Utils'
    ]);
 
    $loader->registerDirs([
        APP_DIR . '/views/'
    ]);
 
    $loader->register();
 
    // Config
    $configPath = CONFIG_DIR . '/default.php';
 
    if (!is_readable($configPath)) {
        throw new Exception('Unable to read config from ' . $configPath);
    }
 
    $config = new Phalcon\Config(include_once $configPath);
 
    $envConfigPath = CONFIG_DIR . '/server.' . APPLICATION_ENV . '.php';
 
    if (!is_readable($envConfigPath)) {
        throw new Exception('Unable to read config from ' . $envConfigPath);
    }
 
    $override = new Phalcon\Config(include_once $envConfigPath);
 
    $config = $config->merge($override);
 
 
    // Instantiate application & DI
    $di = new Phalcon\Di\FactoryDefault();
    $app = new \Phalcon\Mvc\Application($di);
 
    // Bootstrap components
    $bootstrap = new App\Bootstrap(
        new App\Bootstrap\ServiceBootstrap,
        new App\Bootstrap\RouteBootstrap
    );
 
    $bootstrap->run($app, $di, $config);
 
    // Start application
    $app->handle();
 
    // Set appropriate response value
    $response = $app->di->getShared(App\Constants\Services::RESPONSE);
 
} catch (\Exception $e) {
 
    // Handle exceptions
    $di = $app && $app->di ? $app->di : new Phalcon\Di\FactoryDefault();
    $response = $di->getShared(App\Constants\Services::RESPONSE);
    if(!$response){
        $response = new Phalcon\Http\Response();
    }
 
    $debugMode = isset($config->debug) ? $config->debug : (APPLICATION_ENV == 'development');
 
    if($debugMode){
 
        $prettyException = new \Phalcon\Utils\PrettyExceptions();
        $prettyException->setBaseUri($config->website->baseUri . '/_pretty-exception/');
 
        $prettyException->handle($e);
    }
    else {
        
        echo $e->getMessage();
    }
}
finally {
 
    // Send response
    if (!$response->isSent()) {
        $response->send();
    }
Phalcon Framework 3.4.0