久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  1. <small id='hnKwY'></small><noframes id='hnKwY'>

    <tfoot id='hnKwY'></tfoot>
      <bdo id='hnKwY'></bdo><ul id='hnKwY'></ul>

    <legend id='hnKwY'><style id='hnKwY'><dir id='hnKwY'><q id='hnKwY'></q></dir></style></legend>

    1. <i id='hnKwY'><tr id='hnKwY'><dt id='hnKwY'><q id='hnKwY'><span id='hnKwY'><b id='hnKwY'><form id='hnKwY'><ins id='hnKwY'></ins><ul id='hnKwY'></ul><sub id='hnKwY'></sub></form><legend id='hnKwY'></legend><bdo id='hnKwY'><pre id='hnKwY'><center id='hnKwY'></center></pre></bdo></b><th id='hnKwY'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='hnKwY'><tfoot id='hnKwY'></tfoot><dl id='hnKwY'><fieldset id='hnKwY'></fieldset></dl></div>

      通過 SSH 通過 PHP 連接到 mysql 數(shù)據(jù)庫

      Connect to a mysql database via SSH through PHP(通過 SSH 通過 PHP 連接到 mysql 數(shù)據(jù)庫)

          <tfoot id='YtTiI'></tfoot>
            <bdo id='YtTiI'></bdo><ul id='YtTiI'></ul>
            • <i id='YtTiI'><tr id='YtTiI'><dt id='YtTiI'><q id='YtTiI'><span id='YtTiI'><b id='YtTiI'><form id='YtTiI'><ins id='YtTiI'></ins><ul id='YtTiI'></ul><sub id='YtTiI'></sub></form><legend id='YtTiI'></legend><bdo id='YtTiI'><pre id='YtTiI'><center id='YtTiI'></center></pre></bdo></b><th id='YtTiI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YtTiI'><tfoot id='YtTiI'></tfoot><dl id='YtTiI'><fieldset id='YtTiI'></fieldset></dl></div>
                  <tbody id='YtTiI'></tbody>

                <legend id='YtTiI'><style id='YtTiI'><dir id='YtTiI'><q id='YtTiI'></q></dir></style></legend>

                <small id='YtTiI'></small><noframes id='YtTiI'>

                本文介紹了通過 SSH 通過 PHP 連接到 mysql 數(shù)據(jù)庫的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                我已經(jīng)寫了一個本地連接mysql數(shù)據(jù)庫的php文件.現(xiàn)在,我想通過 SSH 連接到遠程數(shù)據(jù)庫.目前,我的數(shù)據(jù)庫的連接函數(shù)在 php 中如下所示:

                $this->db = new mysqli(_SERVR_URL, _SERVR_USER, _SERVR_PASS, _SERVR_DB);如果 ($this->db->connect_errno) {echo "無法連接到 MySQL: (" . $this->db->connect_errno . ") ".$this->db->connect_error;}別的{//echo "連接成功!!

                ";}

                我只想更改連接函數(shù)(以上),以便其余代碼仍然有效.我已經(jīng)成功安裝了 phpseclib 并且對安裝 php 的 ssh 擴展不感興趣,因為經(jīng)過近 5 個小時的努力,這些擴展不起作用.phpseclib 正在工作,我認(rèn)為這是因為當(dāng)我使用 require 時它不會死.

                但是,當(dāng)我嘗試開始使用 ssh 內(nèi)容時,它會引發(fā)服務(wù)器錯誤:

                $ssh = new Net_SSH1(myURL);

                我通常通過 SSH 連接到我的服務(wù)器的方式是使用 .pem 文件.我能否獲得以下方面的指導(dǎo):

                1. 為什么當(dāng)前代碼可能會拋出錯誤?
                2. 如果可能的話.
                3. 您將如何使用 .pem 文件編寫連接代碼.

                解決方案

                我認(rèn)為您在這方面運氣不佳.您可以使用 ssh您的 PHP 代碼中的擴展名,或者如果您有權(quán)訪問服務(wù)器,您可以嘗試在命令行上創(chuàng)建 ssh 隧道.

                不過,您可能需要特殊權(quán)限才能執(zhí)行此操作.它也是您似乎沒有此托管帳戶的 ssh 訪問權(quán)限.

                重復(fù)@jpm 回答>

                設(shè)置隧道 由@ólafur Waage 在 在 PHP 中通過 SSH 連接到 MySQL 服務(wù)器

                和這個用于@@索西

                shell_exec(ssh -f -L 3307:127.0.0.1:3306 user@remote.rjmetrics.com sleep 60 >> logfile");$db = mysqli_connect('127.0.0.1', 'sqluser', 'sqlpassword', 'rjmadmin', 3307);

                I have already written a php file that connects to the mysql database locally. Now, I want to connect to a remote database via SSH. Currently the connect function for my database is the following in php:

                $this->db = new mysqli(_SERVR_URL, _SERVR_USER , _SERVR_PASS, _SERVR_DB);
                    if ($this->db->connect_errno) {
                        echo "Failed to connect to MySQL: (" . $this->db->connect_errno . ") " . $this->db->connect_error;
                    }
                    else{
                        //echo "Successfully connected!! <BR><BR>";
                    }
                

                I want to only change the connect function (above) so that the rest of the code still works. I have successfully installed the phpseclib and am not interested in installing php's ssh extensions because those were not working after nearly 5 hours of effort. The phpseclib is working, and I think this because when I use require it does not die.

                However, when I try to start working with the ssh stuff, it throws a server error:

                $ssh = new Net_SSH1(myURL);
                

                The way that I usually SSH into my server is with a .pem file. Can I get some guidance on:

                1. Why the current code may be throwing an error?
                2. If this is possible.
                3. How would you write the connection code with the .pem file.

                解決方案

                I think you are out of luck on this one. You can either use the ssh extension in your PHP code, or if you have access to the server, you could try to create a ssh tunnel on the command-line.

                You probably need special permissions to do that, though. It also looks like you don't have ssh access to this hosting account.

                duplicate answered by @jpm

                Setting up tunneling posted by @ólafur Waage on Connect to a MySQL server over SSH in PHP

                And this one for tunneling by @Sosy

                shell_exec("ssh -f -L 3307:127.0.0.1:3306 user@remote.rjmetrics.com sleep 60 >> logfile");  
                $db = mysqli_connect(’127.0.0.1′, ‘sqluser’, ‘sqlpassword’, ‘rjmadmin’, 3307);
                

                這篇關(guān)于通過 SSH 通過 PHP 連接到 mysql 數(shù)據(jù)庫的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                Call to undefined function mysqli_result::num_rows()(調(diào)用未定義的函數(shù) mysqli_result::num_rows())
                PHP Prepared Statement Problems(PHP 準(zhǔn)備好的語句問題)
                mysqli_fetch_array returning only one result(mysqli_fetch_array 只返回一個結(jié)果)
                PHP MySQLi Multiple Inserts(PHP MySQLi 多次插入)
                How do I make sure that values from MySQL keep their type in PHP?(如何確保 MySQL 中的值在 PHP 中保持其類型?)
                • <legend id='oPMNI'><style id='oPMNI'><dir id='oPMNI'><q id='oPMNI'></q></dir></style></legend>
                    <bdo id='oPMNI'></bdo><ul id='oPMNI'></ul>

                  • <small id='oPMNI'></small><noframes id='oPMNI'>

                    <tfoot id='oPMNI'></tfoot>
                      <tbody id='oPMNI'></tbody>

                        <i id='oPMNI'><tr id='oPMNI'><dt id='oPMNI'><q id='oPMNI'><span id='oPMNI'><b id='oPMNI'><form id='oPMNI'><ins id='oPMNI'></ins><ul id='oPMNI'></ul><sub id='oPMNI'></sub></form><legend id='oPMNI'></legend><bdo id='oPMNI'><pre id='oPMNI'><center id='oPMNI'></center></pre></bdo></b><th id='oPMNI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='oPMNI'><tfoot id='oPMNI'></tfoot><dl id='oPMNI'><fieldset id='oPMNI'></fieldset></dl></div>
                        • 主站蜘蛛池模板: 欧美影院| 精品无码三级在线观看视频 | 中文字幕在线网 | 日韩中文字幕免费 | 国产一区在线免费观看 | 日韩欧美综合在线视频 | 波多野结衣一区二区三区 | 午夜精品久久久 | 久久久精品久久久 | 日本免费一区二区三区四区 | 日日夜夜视频 | 免费在线成人 | 一区二区三区四区不卡 | 欧美日韩国产一区二区 | 欧美国产激情二区三区 | 国产色 | 久久一区二区精品 | 免费一二区 | 欧美日韩一二三区 | 天天操天天干天天爽 | 久久蜜桃av一区二区天堂 | 99精品99 | 亚洲精品亚洲人成人网 | 欧美日韩精品国产 | 成人在线小视频 | 国产高清视频一区 | 亚洲成人国产综合 | 精品久久久一区二区 | 精品久久久999 | 热久久久 | 三级欧美 | 99久久精品免费看国产四区 | 2019精品手机国产品在线 | 欧美精品在线一区二区三区 | 污视频免费在线观看 | 久久国产激情视频 | 国产精品中文字幕一区二区三区 | 久久99蜜桃综合影院免费观看 | 国产成人99久久亚洲综合精品 | 日韩在线中文字幕 | 精品一区二区在线观看 |