Yiimp: CDbException: CDbConnection 无法打开数据库连接。 hasGetInfo 设置为 false 时出错

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

我收到 CDbConnection failed to open the DB connection 错误。

事实是,我的数据库连接似乎没问题,从 YIIMP 日志显示我打印出的检索值这一事实可以看出(请参阅 yiimp-logs/debug.log ).

除了添加 debuglog 行之外,我没有修改 YIIMP 源代码。

我是 运行 nginx 上的服务器。

我试图找出问题所在,但到目前为止我还没有找到。

是什么导致了这个问题?

提前致谢! :)

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

)

coin.php文件(下面粘贴调用coin_results.php的文件):

<?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

(抱歉,Whosebug 说我超过了字符数限制!: D)

/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 为空。

向上:( 如果您使用示例 php8

,则这是一个常见错误

如果你查看你的仪表板,你会看到主要是红色的,这通常意味着 PHP MySQL 问题或 Mysql

问题

php -v 查看你的版本

您需要确保您有 php7.2 或 php7.3 和 PDO 扩展

确保你设置了这个:

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

他们使用 php7.3 或 7.2

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

再次检查您的服务器,看到是 7.3

php-v

检查您的 nginx 域配置并确保 php-fpm 是版本 7.3 或 7.2

如果您重新启动它们。 Walla 所有作品

尝试将安装 scrypt 与 https://github.com/Kudaraidee/yiimp.git

的最新源版本一起使用

在 Github up Coleganet 中可以使用 Kuraide 源更新脚本,但实际上正在使用 Docker 容器和更高级的设置