[IIS] Fatal Error: CosmicCMS - Help

Vik

Member
Feb 2, 2019
31
15
I'm trying to set up the latest version of CosmicCMS and I've ran in to a Fatal Error and I have no understanding of this at all, although I have followed the video tutorial on Raizer's GitHub thoroughly. Here's a snippet;

Fatal error: Uncaught Pecee\Pixie\Exceptions\ConnectionException: Access denied for user ''@'localhost' (using password: NO) in C:\inetpub\wwwroot\cosmicproject.online\Cosmic\vendor\pecee\pixie\src\Pecee\Pixie\Exception.php:79 Stack trace: #0 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\vendor\pecee\pixie\src\Pecee\Pixie\ConnectionAdapters\Mysql.php(58): Pecee\Pixie\Exception::create() #1 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\vendor\pecee\pixie\src\Pecee\Pixie\ConnectionAdapters\BaseAdapter.php(25): Pecee\Pixie\ConnectionAdapters\Mysql->doConnect() #2 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\vendor\pecee\pixie\src\Pecee\Pixie\Connection.php(93): Pecee\Pixie\ConnectionAdapters\BaseAdapter->connect() #3 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\vendor\pecee\pixie\src\Pecee\Pixie\QueryBuilder\QueryBuilderHandler.php(96): Pecee\Pixie\Connection->connect() #4 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\vendor\pecee\pixie\src\Pecee\Pixie\Connection.php(138): Pecee\Pixie\QueryBuilder\QueryBuilderHandler->__construct() #5 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\src\System\DatabaseService.php(32): Pecee\Pixie\Connection->getQueryBuilder() #6 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\src\App\Models\Player.php(24): Cosmic\System\DatabaseService::connection() #7 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\src\App\Middleware\AuthMiddleware.php(22): Cosmic\App\Models\Player::getDataById() #8 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\vendor\pecee\simple-router\src\Pecee\SimpleRouter\Route\LoadableRoute.php(51): Cosmic\App\Middleware\AuthMiddleware->handle() #9 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\vendor\pecee\simple-router\src\Pecee\SimpleRouter\Router.php(399): Pecee\SimpleRouter\Route\LoadableRoute->loadMiddleware() #10 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\vendor\pecee\simple-router\src\Pecee\SimpleRouter\Router.php(343): Pecee\SimpleRouter\Router->routeRequest() #11 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\vendor\pecee\simple-router\src\Pecee\SimpleRouter\SimpleRouter.php(69): Pecee\SimpleRouter\Router->start() #12 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\src\System\RouterService.php(153): Pecee\SimpleRouter\SimpleRouter::start() #13 C:\inetpub\wwwroot\cosmicproject.online\Cosmic\public\index.php(29): Cosmic\System\RouterService->init() #14 {main} thrown in C:\inetpub\wwwroot\cosmicproject.online\Cosmic\vendor\pecee\pixie\src\Pecee\Pixie\Exception.php on line 79


O8LHUYi.png

Any help at all would be greatly appreciated!
 

Vik

Member
Feb 2, 2019
31
15
Something to do with your MYSQL password in your Cosmic config.
I thought that myself and I've reset my password twice now and matched from the MYSQL to the Config. I'm sure that's correct.
PHP:
<?php
namespace Cosmic\System;

use Exception;
use PDO;
use \Pecee\Pixie\Connection;

class DatabaseService {

    public static $instance;
 
    public static function connection(){
      
        $dotenv = new \Symfony\Component\Dotenv\Dotenv(true);
        $dotenv->loadEnv(dirname(__DIR__).'/../.env');
      
        $config = [
            'driver'    => getenv('mysql'),
            'host'      => getenv('localhost'),
            'database'  => getenv('hotel'),
            'username'  => getenv('root'),
            'password'  => getenv('redneck123'),
            'charset'   => getenv('uf8'),
            'collation' => getenv('collation'),
            'options'   => [
                PDO::ATTR_TIMEOUT => 5,
                PDO::ATTR_EMULATE_PREPARES => false,
            ],
        ];
      
        if(!isset(self::$instance)){
            self::$instance = (new \Pecee\Pixie\Connection('mysql', $config))->getQueryBuilder();
        }
        return self::$instance;
    }
}
 

Users who are viewing this thread

Top