pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  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="uk0gsou" id='hnKwY'><tfoot id='hnKwY'></tfoot><dl id='hnKwY'><fieldset id='hnKwY'></fieldset></dl></div>

      通過 SSH 通過 PHP 連接到 mysql 數據庫

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

          <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="gqg0gec" 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 數據庫的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我已經寫了一個本地連接mysql數據庫的php文件.現在,我想通過 SSH 連接到遠程數據庫.目前,我的數據庫的連接函數在 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 "連接成功!!

                ";}

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

                但是,當我嘗試開始使用 ssh 內容時,它會引發服務器錯誤:

                $ssh = new Net_SSH1(myURL);

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

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

                解決方案

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

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

                重復@jpm 回答>

                設置隧道 由@ólafur Waage 在 在 PHP 中通過 SSH 連接到 MySQL 服務器

                和這個用于@@索西

                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);
                

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

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

                相關文檔推薦

                store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                Call to undefined function mysqli_result::num_rows()(調用未定義的函數 mysqli_result::num_rows())
                PHP Prepared Statement Problems(PHP 準備好的語句問題)
                mysqli_fetch_array returning only one result(mysqli_fetch_array 只返回一個結果)
                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="c2aqksw" id='oPMNI'><tfoot id='oPMNI'></tfoot><dl id='oPMNI'><fieldset id='oPMNI'></fieldset></dl></div>
                        • 主站蜘蛛池模板: UV-1800紫外光度计-紫外可见光度计厂家-翱艺仪器(上海)有限公司 | 微波消解仪器_智能微波消解仪报价_高压微波消解仪厂家_那艾 | 据信,上课带着跳 D 体验-别样的课堂刺激感受引发网友热议 | 自动检重秤-动态称重机-重量分选秤-苏州金钻称重设备系统开发有限公司 | 集菌仪厂家_全封闭_封闭式_智能智能集菌仪厂家-上海郓曹 | 转子泵_凸轮泵_凸轮转子泵厂家-青岛罗德通用机械设备有限公司 | 地磅-地秤-江阴/无锡地磅-江阴天亿计量设备有限公司_ | 发电机价格|发电机组价格|柴油发电机价格|柴油发电机组价格网 | 河南卓美创业科技有限公司-河南卓美防雷公司-防雷接地-防雷工程-重庆避雷针-避雷器-防雷检测-避雷带-避雷针-避雷塔、机房防雷、古建筑防雷等-山西防雷公司 | 成都LED显示屏丨室内户外全彩led屏厂家方案报价_四川诺显科技 | 防渗土工膜|污水处理防渗膜|垃圾填埋场防渗膜-泰安佳路通工程材料有限公司 | 南京雕塑制作厂家-不锈钢雕塑制作-玻璃钢雕塑制作-先登雕塑厂 | 有源电力滤波装置-电力有源滤波器-低压穿排电流互感器|安科瑞 | 塑料检查井_双扣聚氯乙烯增强管_双壁波纹管-河南中盈塑料制品有限公司 | 伊卡洛斯软装首页-电动窗帘,别墅窗帘,定制窗帘,江浙沪1000+别墅窗帘案例 | 3dmax渲染-效果图渲染-影视动画渲染-北京快渲科技有限公司 | 缝纫客| 中国品牌排名投票_十大品牌榜单_中国著名品牌【中国品牌榜】 | 青岛成人高考_山东成考报名网 | 磨煤机配件-高铬辊套-高铬衬板-立磨辊套-盐山县宏润电力设备有限公司 | 美能达分光测色仪_爱色丽分光测色仪-苏州方特电子科技有限公司 | 急救箱-应急箱-急救包厂家-北京红立方医疗设备有限公司 | 智能交通网_智能交通系统_ITS_交通监控_卫星导航_智能交通行业 | 范秘书_懂你的范文小秘书| 防渗膜厂家|养殖防渗膜|水产养殖防渗膜-泰安佳路通工程材料有限公司 | 济南网站建设_济南网站制作_济南网站设计_济南网站建设公司_富库网络旗下模易宝_模板建站 | 重庆中专|职高|技校招生-重庆中专招生网 | SPC工作站-连杆综合检具-表盘气动量仪-内孔缺陷检测仪-杭州朗多检测仪器有限公司 | 家庭教育吧-在线家庭教育平台,专注青少年家庭教育 | 全自动固相萃取仪_高通量真空平行浓缩仪-勤业永为 | 陕西视频监控,智能安防监控,安防系统-西安鑫安5A安防工程公司 | 水厂自动化|污水处理中控系统|水利信息化|智慧水务|智慧农业-山东德艾自动化科技有限公司 | 水篦子|雨篦子|镀锌格栅雨水篦子|不锈钢排水篦子|地下车库水箅子—安平县云航丝网制品厂 | 武汉高低温试验箱_恒温恒湿试验箱厂家-武汉蓝锐环境科技有限公司 | 佛山商标注册_商标注册代理|专利注册申请_商标注册公司_鸿邦知识产权 | 万师讲师网-优质讲师培训师供应商,讲师认证,找讲师来万师 | 自动钻孔机-全自动数控钻孔机生产厂家-多米(广东)智能装备有限公司 | ★店家乐|服装销售管理软件|服装店收银系统|内衣店鞋店进销存软件|连锁店管理软件|收银软件手机版|会员管理系统-手机版,云版,App | 招商帮-一站式网络营销服务|搜索营销推广|信息流推广|短视视频营销推广|互联网整合营销|网络推广代运营|招商帮企业招商好帮手 | 超声波成孔成槽质量检测仪-压浆机-桥梁预应力智能张拉设备-上海硕冠检测设备有限公司 | CCE素质教育博览会 | CCE素博会 | 教育展 | 美育展 | 科教展 | 素质教育展 |