Skip to content
Advertisement

Yiimp: CDbException: CDbConnection failed to open the DB connection. error when hasGetInfo is set to false

I’m getting the CDbConnection failed to open the DB connection error.

The thing is, my database connection seems to be okay, as evident from the fact that the YIIMP logs display the retrieved values that I print out (see the text in the yiimp-logs/debug.log).

I haven’t modified the YIIMP source codes besides adding the debuglog lines.

I’m running the server on nginx.

I’ve tried to figure out where the problem lies but so far I haven’t been able to.

What could be causing this issue?

Thanks a ton in advance! 🙂

yiimp-logs/debug.log:

[2022-01-18 16:06:53] wallet-rc.php construtor

[2022-01-18 16:06:53] Bitcoin RPC detected

[2022-01-18 16:06:53] wallet-rpc.php call method

[2022-01-18 16:06:53] Bitcoin RPC, getInfo is set to false

[2022-01-18 16:06:53] array

(

    'blocks' => 18541

    'difficulty' => 818.13886010363

    'testnet' => false

    'walletversion' => null

    'balance' => null

    'keypoololdest' => null

    'keypoolsize' => null

    'paytxfee' => null

    'version' => 229900

    'protocolversion' => 70016

    'timeoffset' => 0

    'connections' => 3

    'relayfee' => 1.0E-5

)



[2022-01-18 16:06:53] info is:

[2022-01-18 16:06:53] array

(

    'blocks' => 18541

    'difficulty' => 818.13886010363

    'testnet' => false

    'walletversion' => null

    'balance' => null

    'keypoololdest' => null

    'keypoolsize' => null

    'paytxfee' => null

    'version' => 229900

    'protocolversion' => 70016

    'timeoffset' => 0

    'connections' => 3

    'relayfee' => 1.0E-5

)



[2022-01-18 16:06:53] remote is:

[2022-01-18 16:06:53] WalletRPC#1

(

    [type] => 'Bitcoin'

    [*:rpc] => Bitcoin#2

    (

        [Bitcoin:username] => 'yiimprpc'

        [Bitcoin:password] => 'passwordgetsshownhere'

        [Bitcoin:proto] => 'http'

        [Bitcoin:host] => '127.0.0.1'

        [Bitcoin:port] => '8836'

        [Bitcoin:url] => null

        [Bitcoin:CACertificate] => null

        [status] => 200

        [error] => null

        [raw_response] => '{"result":{"version":229900,"subversion":"/Satoshi:22.99.0/","protocolversion":70016,"localservices":"0000000000000409","localservicesnames":["NETWORK","WITNESS","NETWORK_LIMITED"],"localrelay":true,"timeoffset":0,"networkactive":true,"connections":3,"connections_in":0,"connections_out":3,"networks":[{"name":"ipv4","limited":false,"reachable":true,"proxy":"","proxy_randomize_credentials":false},{"name":"ipv6","limited":false,"reachable":true,"proxy":"","proxy_randomize_credentials":false},{"name":"onion","limited":true,"reachable":false,"proxy":"","proxy_randomize_credentials":false},{"name":"i2p","limited":true,"reachable":false,"proxy":"","proxy_randomize_credentials":false}],"relayfee":0.00001000,"incrementalfee":0.00001000,"localaddresses":[{"address":"serveripaddressgetsshownhere","port":8863,"score":1}],"warnings":"This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"},"error":null,"id":3}

'

        [response] => array(...)

        [Bitcoin:id] => 3

    )

    [*:rpc_wallet] => null

    [*:hasGetInfo] => '0'

    [*:account] => null

    [*:accounts] => null

    [*:coin] => null

    [*:info] => null

    [*:height] => 0

    [error] => null

)



[2022-01-18 16:06:54] wallet-rc.php construtor

[2022-01-18 16:06:54] Bitcoin RPC detected

[2022-01-18 16:06:54] remote in coin_results.php is:

[2022-01-18 16:06:54] WalletRPC#1

(

    [type] => 'Bitcoin'

    [*:rpc] => Bitcoin#2

    (

        [Bitcoin:username] => 'yiimprpc'

        [Bitcoin:password] => 'passwordgetshownhere'

        [Bitcoin:proto] => 'http'

        [Bitcoin:host] => '127.0.0.1'

        [Bitcoin:port] => '8836'

        [Bitcoin:url] => null

        [Bitcoin:CACertificate] => null

        [status] => null

        [error] => null

        [raw_response] => null

        [response] => null

        [Bitcoin:id] => 0

    )

    [*:rpc_wallet] => null

    [*:hasGetInfo] => '0'

    [*:account] => null

    [*:accounts] => null

    [*:coin] => null

    [*:info] => null

    [*:height] => 0

    [error] => null

)

[2022-01-18 16:06:54] reserved1 after dboscalar in coin_results.php is:

[2022-01-18 16:06:54]

[2022-01-18 16:06:54] reserved1 after altcoinvaluetoa in coin_results.php is:

[2022-01-18 16:06:54] 0.000000

[2022-01-18 16:06:54] owed after dboscalar in coin_results.php is:

[2022-01-18 16:06:54]

[2022-01-18 16:06:54] wallet-rpc.php call method

[2022-01-18 16:06:54] Bitcoin RPC, getInfo is set to false

[2022-01-18 16:06:54] array

(

    'blocks' => 18541

    'difficulty' => 818.13886010363

    'testnet' => false

    'walletversion' => null

    'balance' => null

    'keypoololdest' => null

    'keypoolsize' => null

    'paytxfee' => null

    'version' => 229900

    'protocolversion' => 70016

    'timeoffset' => 0

    'connections' => 3

    'relayfee' => 1.0E-5

)



[2022-01-18 17:07:01] CDbException#1

(

    [*:message] => 'CDbConnection failed to open the DB connection.'

    [Exception:string] => ''

    [*:code] => 0

    [*:file] => '/var/web/framework/db/CDbConnection.php'

    [*:line] => 405

    [Exception:trace] => array

    (

        0 => array

        (

            'file' => '/var/web/framework/db/CDbConnection.php'

            'line' => 347

            'function' => 'open'

            'class' => 'CDbConnection'

            'type' => '->'

        )

        1 => array

        (

            'file' => '/var/web/framework/db/CDbConnection.php'

            'line' => 325

            'function' => 'setActive'

            'class' => 'CDbConnection'

            'type' => '->'

        )

        2 => array

        (

            'file' => '/var/web/framework/base/CModule.php'

            'line' => 394

            'function' => 'init'

            'class' => 'CDbConnection'

            'type' => '->'

        )

        3 => array

        (

            'file' => '/var/web/framework/base/CModule.php'

            'line' => 103

            'function' => 'getComponent'

            'class' => 'CModule'

            'type' => '->'

        )

        4 => array

        (

            'file' => '/var/web/yaamp/core/common/libdbo.php'

            'line' => 56

            'function' => '__get'

            'class' => 'CModule'

            'type' => '->'

        )

        5 => array

        (

            'file' => '/var/web/yaamp/core/functions/settings.php'

            'line' => 17

            'function' => 'dborow'

        )

        6 => array

        (

            'file' => '/var/web/yaamp/core/functions/settings.php'

            'line' => 104

            'function' => 'settings_get'

        )

        7 => array

        (

            'file' => '/var/web/yaamp/core/trading/binance_trading.php'

            'line' => 15

            'function' => 'exchange_get'

        )

        8 => array

        (

            'file' => '/var/web/yaamp/modules/thread/CronjobController.php'

            'line' => 142

            'function' => 'doBinanceTrading'

        )

        9 => array

        (

            'file' => '/var/web/framework/web/actions/CInlineAction.php'

            'line' => 49

            'function' => 'actionRun'

            'class' => 'CronjobController'

            'type' => '->'

        )

        10 => array

        (

            'file' => '/var/web/framework/web/CController.php'

            'line' => 308

            'function' => 'runWithParams'

            'class' => 'CInlineAction'

            'type' => '->'

        )

        11 => array

        (

            'file' => '/var/web/framework/web/CController.php'

            'line' => 286

            'function' => 'runAction'

            'class' => 'CController'

            'type' => '->'

        )

        12 => array

        (

            'file' => '/var/web/framework/web/CController.php'

            'line' => 265

            'function' => 'runActionWithFilters'

            'class' => 'CController'

            'type' => '->'

        )

        13 => array

        (

            'file' => '/var/web/yaamp/components/CYiimpConsoleApp.php'

            'line' => 125

            'function' => 'run'

            'class' => 'CController'

            'type' => '->'

        )

        14 => array

        (

            'file' => '/var/web/runconsole.php'

            'line' => 18

            'function' => 'runController'

            'class' => 'CYiimpConsoleApp'

            'type' => '->'

        )

    )

    [Exception:previous] => null

    [errorInfo] => null

)



[2022-01-18 17:07:01] CDbException#1

(

    [*:message] => 'CDbConnection failed to open the DB connection.'

    [Exception:string] => ''

    [*:code] => 0

    [*:file] => '/var/web/framework/db/CDbConnection.php'

    [*:line] => 405

    [Exception:trace] => array

    (

        0 => array

        (

            'file' => '/var/web/framework/db/CDbConnection.php'

            'line' => 347

            'function' => 'open'

            'class' => 'CDbConnection'

            'type' => '->'

        )

        1 => array

        (

            'file' => '/var/web/framework/db/CDbConnection.php'

            'line' => 325

            'function' => 'setActive'

            'class' => 'CDbConnection'

            'type' => '->'

        )

        2 => array

        (

            'file' => '/var/web/framework/base/CModule.php'

            'line' => 394

            'function' => 'init'

            'class' => 'CDbConnection'

            'type' => '->'

        )

        3 => array

        (

            'file' => '/var/web/framework/base/CModule.php'

            'line' => 103

            'function' => 'getComponent'

            'class' => 'CModule'

            'type' => '->'

        )

        4 => array

        (

            'file' => '/var/web/yaamp/core/common/libdbo.php'

            'line' => 46

            'function' => '__get'

            'class' => 'CModule'

            'type' => '->'

        )

        5 => array

        (

            'file' => '/var/web/yaamp/core/functions/settings.php'

            'line' => 64

            'function' => 'dboscalar'

        )

        6 => array

        (

            'file' => '/var/web/yaamp/core/functions/settings.php'

            'line' => 198

            'function' => 'settings_set_default'

        )

        7 => array

        (

            'file' => '/var/web/yaamp/core/backend/markets.php'

            'line' => 7

            'function' => 'market_set_default'

        )

        8 => array

        (

            'file' => '/var/web/yaamp/modules/thread/CronjobController.php'

            'line' => 152

            'function' => 'BackendPricesUpdate'

        )

        9 => array

        (

            'file' => '/var/web/framework/web/actions/CInlineAction.php'

            'line' => 49

            'function' => 'actionRun'

            'class' => 'CronjobController'

            'type' => '->'

        )

        10 => array

        (

            'file' => '/var/web/framework/web/CController.php'

            'line' => 308

            'function' => 'runWithParams'

            'class' => 'CInlineAction'

            'type' => '->'

        )

        11 => array

        (

            'file' => '/var/web/framework/web/CController.php'

            'line' => 286

            'function' => 'runAction'

            'class' => 'CController'

            'type' => '->'

        )

        12 => array

        (

            'file' => '/var/web/framework/web/CController.php'

            'line' => 265

            'function' => 'runActionWithFilters'

            'class' => 'CController'

            'type' => '->'

        )

        13 => array

        (

            'file' => '/var/web/yaamp/components/CYiimpConsoleApp.php'

            'line' => 125

            'function' => 'run'

            'class' => 'CController'

            'type' => '->'

        )

        14 => array

        (

            'file' => '/var/web/runconsole.php'

            'line' => 18

            'function' => 'runController'

            'class' => 'CYiimpConsoleApp'

            'type' => '->'

        )

    )

    [Exception:previous] => null

    [errorInfo] => null

)



[2022-01-18 17:07:03] CDbException#1

(

    [*:message] => 'CDbConnection failed to open the DB connection.'

    [Exception:string] => ''

    [*:code] => 0

    [*:file] => '/var/web/framework/db/CDbConnection.php'

    [*:line] => 405

    [Exception:trace] => array

    (

        0 => array

        (

            'file' => '/var/web/framework/db/CDbConnection.php'

            'line' => 347

            'function' => 'open'

            'class' => 'CDbConnection'

            'type' => '->'

        )

        1 => array

        (

            'file' => '/var/web/framework/db/CDbConnection.php'

            'line' => 325

            'function' => 'setActive'

            'class' => 'CDbConnection'

            'type' => '->'

        )

        2 => array

        (

            'file' => '/var/web/framework/base/CModule.php'

            'line' => 394

            'function' => 'init'

            'class' => 'CDbConnection'

            'type' => '->'

        )

        3 => array

        (

            'file' => '/var/web/framework/base/CModule.php'

            'line' => 103

            'function' => 'getComponent'

            'class' => 'CModule'

            'type' => '->'

        )

        4 => array

        (

            'file' => '/var/web/yaamp/core/common/libdbo.php'

            'line' => 36

            'function' => '__get'

            'class' => 'CModule'

            'type' => '->'

        )

        5 => array

        (

            'file' => '/var/web/yaamp/modules/thread/CronjobController.php'

            'line' => 51

            'function' => 'dborun'

        )

        6 => array

        (

            'file' => '/var/web/framework/web/actions/CInlineAction.php'

            'line' => 49

            'function' => 'actionRunBlocks'

            'class' => 'CronjobController'

            'type' => '->'

        )

        7 => array

        (

            'file' => '/var/web/framework/web/CController.php'

            'line' => 308

            'function' => 'runWithParams'

            'class' => 'CInlineAction'

            'type' => '->'

        )

        8 => array

        (

            'file' => '/var/web/framework/web/CController.php'

            'line' => 286

            'function' => 'runAction'

            'class' => 'CController'

            'type' => '->'

        )

        9 => array

        (

            'file' => '/var/web/framework/web/CController.php'

            'line' => 265

            'function' => 'runActionWithFilters'

            'class' => 'CController'

            'type' => '->'

        )

        10 => array

        (

            'file' => '/var/web/yaamp/components/CYiimpConsoleApp.php'

            'line' => 125

            'function' => 'run'

            'class' => 'CController'

            'type' => '->'

        )

        11 => array

        (

            'file' => '/var/web/runconsole.php'

            'line' => 18

            'function' => 'runController'

            'class' => 'CYiimpConsoleApp'

            'type' => '->'

        )

    )

    [Exception:previous] => null

    [errorInfo] => null

)



[2022-01-18 17:07:03] CDbException#1

(

    [*:message] => 'CDbConnection failed to open the DB connection.'

    [Exception:string] => ''

    [*:code] => 0

    [*:file] => '/var/web/framework/db/CDbConnection.php'

    [*:line] => 405

    [Exception:trace] => array

    (

        0 => array

        (

            'file' => '/var/web/framework/db/CDbConnection.php'

            'line' => 347

            'function' => 'open'

            'class' => 'CDbConnection'

            'type' => '->'

        )

        1 => array

        (

            'file' => '/var/web/framework/db/CDbConnection.php'

            'line' => 325

            'function' => 'setActive'

            'class' => 'CDbConnection'

            'type' => '->'

        )

        2 => array

        (

            'file' => '/var/web/framework/base/CModule.php'

            'line' => 394

            'function' => 'init'

            'class' => 'CDbConnection'

            'type' => '->'

        )

        3 => array

        (

            'file' => '/var/web/framework/base/CModule.php'

            'line' => 103

            'function' => 'getComponent'

            'class' => 'CModule'

            'type' => '->'

        )

        4 => array

        (

            'file' => '/var/web/yaamp/core/common/libdbo.php'

            'line' => 36

            'function' => '__get'

            'class' => 'CModule'

            'type' => '->'

        )

        5 => array

        (

            'file' => '/var/web/yaamp/modules/thread/CronjobController.php'

            'line' => 51

            'function' => 'dborun'

        )

        6 => array

        (

            'file' => '/var/web/framework/web/actions/CInlineAction.php'

            'line' => 49

            'function' => 'actionRunBlocks'

            'class' => 'CronjobController'

            'type' => '->'

        )

        7 => array

        (

            'file' => '/var/web/framework/web/CController.php'

            'line' => 308

            'function' => 'runWithParams'

            'class' => 'CInlineAction'

            'type' => '->'

        )

        8 => array

        (

            'file' => '/var/web/framework/web/CController.php'

            'line' => 286

            'function' => 'runAction'

            'class' => 'CController'

            'type' => '->'

        )

        9 => array

        (

            'file' => '/var/web/framework/web/CController.php'

            'line' => 265

            'function' => 'runActionWithFilters'

            'class' => 'CController'

            'type' => '->'

        )

        10 => array

        (

            'file' => '/var/web/yaamp/components/CYiimpConsoleApp.php'

            'line' => 125

            'function' => 'run'

            'class' => 'CController'

            'type' => '->'

        )

        11 => array

        (

            'file' => '/var/web/runconsole.php'

            'line' => 18

            'function' => 'runController'

            'class' => 'CYiimpConsoleApp'

            'type' => '->'

        )

    )

    [Exception:previous] => null

    [errorInfo] => null

)

The coin.php file (the file that calls coin_results.php pasted below):

<?php

$id = getiparam('id');
$coin = getdbo('db_coins', $id);
if (!$coin) {
    $this->goback();
}

$this->pageTitle = 'Wallet - '.$coin->symbol;

// force a refresh after 10mn to prevent memory leaks in chrome
app()->clientScript->registerMetaTag('600', null, 'refresh');

if (!empty($coin->algo) && $coin->algo != 'PoS')
    user()->setState('yaamp-algo', $coin->algo);

$remote = new WalletRPC($coin);
$info = $remote->getinfo();
debuglog("info is:");
debuglog($info);
debuglog("remote is:");
debuglog($remote);

$sellamount = $coin->balance;
//if ($info) $sellamount = floatval($sellamount) - arraySafeVal($info, "paytxfee") * 3;

echo getAdminSideBarLinks().'<br/><br/>';
echo getAdminWalletLinks($coin, $info, 'wallet');

$maxrows = arraySafeVal($_REQUEST,'rows', 500);
$since = arraySafeVal($_REQUEST,'since', time() - (7*24*3600)); // one week

echo '<div id="main_actions">';

app()->clientScript->registerCoreScript('jquery.ui'); // dialog

/* 
echo "<br><a href='/site/makeconfigfile?id=$coin->id'><b>MAKE CONFIG & START</b></a>";

if($info)
{
    echo "<br><a href='/site/restartcoin?id=$coin->id'><b>RESTART COIND</b></a>";
    echo "<br><a href='/site/stopcoin?id=$coin->id'><b>STOP COIND</b></a>";

    if(isset($info['balance']) && $info['balance'] && !empty($coin->deposit_address))
        echo "<br><a href='javascript:showSellAmountDialog()'><b>SEND BALANCE TO</b></a> - $coin->deposit_address";
}
else
{
    echo "<br><a href='/site/startcoin?id=$coin->id'><b>START COIND</b></a>";
    echo "<br><br><a href='/site/resetblockchain?id=$coin->id'><b>RESET BLOCKCHAIN</b></a>";

    if($coin->installed)
        echo "<br><a href='javascript:uninstall_coin();'><b>UNINSTALL COIN</b></a><br>";
}

*/
echo <<<END

<br/><a class="red" href="/site/deleteearnings?id={$coin->id}"><b>DELETE EARNINGS</b></a>
<br/><a href="/site/clearearnings?id={$coin->id}"><b>CLEAR EARNINGS</b></a>
<br/><a href="/site/checkblocks?id={$coin->id}"><b>UPDATE BLOCKS</b></a>
<br/><a href="/site/payuserscoin?id={$coin->id}"><b>DO PAYMENTS</b></a>
<br/>
</div>

<style type="text/css">
table.dataGrid a.red, table.dataGrid a.red:visited, a.red { color: darkred; }
div#main_actions {
    position: absolute; top: 60px; right: 16px; width: 280px; text-align: right;
}
div#markets {
    overflow-x: hidden; overflow-y: scroll; max-height: 156px;
}
div#transactions {
    overflow-x: hidden; overflow-y: scroll; min-height: 200px; max-height: 360px;
    margin-bottom: 8px;
}
div#sums {
    overflow-x: hidden; overflow-y: scroll; min-height: 250px; max-height: 600px;
    width: 380px; float: left; margin-top: 16px; margin-bottom: 8px; margin-right: 16px;
}
.page .footer { clear: both; width: auto; margin-top: 16px; }
tr.ssrow.bestmarket { background-color: #dfd; }
tr.ssrow.disabled { background-color: #fdd; color: darkred; }
tr.ssrow.orphan { color: darkred; }
</style>

<div id="main_results"></div>

<script type="text/javascript">

function uninstall_coin()
{
    if(!confirm("Uninstall this coin?"))
        return;

    window.location.href = '/site/uninstallcoin?id=$coin->id';
}

var main_delay=30000;
var main_timeout;

function main_refresh()
{
    var url = "/site/coin_results?id={$id}&rows={$maxrows}&since={$since}";

    clearTimeout(main_timeout);
    $.get(url, '', main_ready).error(main_error);
}

function main_ready(data)
{
    $('#main_results').html(data);
    $(window).trigger('resize'); // will draw graph
    main_timeout = setTimeout(main_refresh, main_delay);
}

function main_error()
{
    console.log("main_error in coin.php");
    main_timeout = setTimeout(main_refresh, main_delay*2);
}

function showSellAmountDialog(marketname, address, marketid, bookmarkid)
{
    $("#dlgaddr").html(address);
    $("#sell-amount-dialog").dialog(
    {
        autoOpen: true,
        width: 400,
        height: 240,
        modal: true,
        title: 'Send $coin->symbol to '+marketname,

        buttons:
        {
            "Send / Sell": function()
            {
                amount = $('#input_sell_amount').val();
                if (marketid > 0)
                    window.location.href = '/market/sellto?id='+marketid+'&amount='+amount;
                else
                    window.location.href = '/site/bookmarkSend?id='+bookmarkid+'&amount='+amount;
            },
        }
    });
    return false;
}

</script>

<div id="sell-amount-dialog" style="display: none;">
<br>
Address: <span id="dlgaddr">xxxxxxxxxxxx</span><br><br>
Amount: <input type=text id="input_sell_amount" value="$sellamount">
<br>
</div>

END;

JavascriptReady("main_refresh();");

if ($coin->watch) {
    $this->renderPartial('coin_market_graph', array('coin'=>$coin));
    JavascriptReady("$(window).resize(graph_resized);");
}

coin_results.php:

https://pastebin.com/kN2FPbXy

(sorry, StackOverflow says I’m past the character limit! 😀 )

/var/log/nginx/access.log:

[my ip address] - - [18/Jan/2022:16:06:53 +0000] "GET /site/coin?id=1 HTTP/1.1" 200 2213 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
[my ip address] - - [18/Jan/2022:16:06:54 +0000] "GET /site/coin_results?id=1&rows=500&since=1641917213 HTTP/1.1" 500 75 "http://[server's ip address]/site/coin?id=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"

/var/log/nginx/error.log is empty.

Advertisement

Answer

ups 🙁 is a common error if you are using by example php8

if you look at your Dashboard you will see the main is in red color that means normally a PHP problem with MySQL or a problem with Mysql

php -v to see your version

You need to be sure you have php7.2 or php7.3 and teh PDO extension

Make sure you setup this:

 apt-get install software-properties-common
    sudo add-apt-repository -y ppa:ondrej/php
    sudo apt-get update

Them use php7.3 or 7.2

update-alternatives –set php /usr/bin/php7.3

again check your server and see is 7.3

php -v

Check your nginx domain config and make sure php-fpm is version 7.3 or 7.2

them if you reboot . Walla all works

Try to use an install scrypt with the last sources version of https://github.com/Kudaraidee/yiimp.git

Updates scripts with Kuraide sources are available in Github up Coleganet but actually are using Docker Container and more advance setup

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement