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

<tfoot id='3Y4Mi'></tfoot>

    <small id='3Y4Mi'></small><noframes id='3Y4Mi'>

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

    1. PHP到EasyPHP MySQL服務器1秒連接延遲

      PHP to EasyPHP MySQL server 1 second connection delay(PHP到EasyPHP MySQL服務器1秒連接延遲)
      <legend id='7RRH7'><style id='7RRH7'><dir id='7RRH7'><q id='7RRH7'></q></dir></style></legend>
        <bdo id='7RRH7'></bdo><ul id='7RRH7'></ul>

      • <small id='7RRH7'></small><noframes id='7RRH7'>

        <i id='7RRH7'><tr id='7RRH7'><dt id='7RRH7'><q id='7RRH7'><span id='7RRH7'><b id='7RRH7'><form id='7RRH7'><ins id='7RRH7'></ins><ul id='7RRH7'></ul><sub id='7RRH7'></sub></form><legend id='7RRH7'></legend><bdo id='7RRH7'><pre id='7RRH7'><center id='7RRH7'></center></pre></bdo></b><th id='7RRH7'></th></span></q></dt></tr></i><div class="nfbthhr" id='7RRH7'><tfoot id='7RRH7'></tfoot><dl id='7RRH7'><fieldset id='7RRH7'></fieldset></dl></div>

                <tbody id='7RRH7'></tbody>

              • <tfoot id='7RRH7'></tfoot>
                本文介紹了PHP到EasyPHP MySQL服務器1秒連接延遲的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我在這里問這個是因為我認為它不僅僅適用于 EasyPHP 本身.

                I'm asking this here because I think it applies to more than just EasyPHP itself.

                我目前使用 EasyPHP 作為我的 WAMP 開發服務器,因此我可以創建 Web 應用程序.問題是,當我讓 mysqli 對象連接到數據庫時,它需要 1 秒.在共享主機上運行相同的查詢會導致速度提高 200 倍以上.這是我應該擔心的事情嗎?在可擴展性或將我的應用程序移動到另一臺服務器方面,花點時間看看問題是什么是明智的嗎?我只是假設 EasyPHP 可能很慢.不是專業,只是讓我覺得有趣的事情.

                I currently use EasyPHP as my WAMP development server so I can create web applications. The problem is, when I get the mysqli object to connect to the database it takes 1 second. Running the same query on shared hosting results in speeds over 200 times faster. Should this be something I should be worried about? In terms of scalability or moving my application to another server would it be smart to spend a while seeing what the issue is? I just assumed that perhaps EasyPHP was slow. Not a major, just something that struck me as interesting.

                推薦答案

                如果您遇到此問題并且使用的是 Windows 7 之前的 Windows 版本,這可能不是您問題的答案.

                為什么會這樣?

                這個問題的原因是 IPv4 vs IPv6.

                The cause of this problem is IPv4 vs IPv6.

                當您使用主機名而不是 IP 地址時,MySQL 客戶端首先運行 AAAA (IPv6) 主機查找名稱,如果成功將名稱解析為IPv6 地址.如果任一步驟失敗(名稱解析或連接),它將回退到 IPv4,運行 A 查找并嘗試使用此主機.

                When you use a host name instead of an IP address, the MySQL client first runs an AAAA (IPv6) host lookup for the name, and tries this address first if it successfully resolves the name to an IPv6 address. If either step fails (name resolution or connection) it will fallback to IPv4, running an A lookup and trying this host instead.

                這在實踐中意味著如果 IPv6 localhost 查找成功但 MySQL 未綁定到 IPv6 環回,您將需要等待一個連接超時周期(顯然在 OP 的機器上)這是發生 IPv4 回退和連接成功之前的 1 秒).

                What this means in practice is that if the IPv6 localhost lookup is successful but MySQL is not bound to the IPv6 loopback, you will need to wait for one connection timeout cycle (evidently on the OP's machine this is 1 second) before the IPv4 fallback occurs and the connection succeeds.

                這在 Windows 7 之前不是問題,因為 localhost 解析是通過主機文件完成的,并且它只預先配置了 127.0.0.1 - 它沒有附帶它的 IPv6 對應物 ::1.

                This was not an issue prior to Windows 7, because localhost resolution was done via the hosts file, and it came preconfigured with only 127.0.0.1 - it did not come with it's IPv6 counterpart ::1.

                但是,從 Windows 7 開始,localhost 解析內置于 DNS 解析器中,原因在此處.這意味著 IPv6 查找現在將成功 - 但 MySQL 未綁定到該 IPv6 地址,因此連接將失敗,您將看到此問題中概述的延遲.

                Since Windows 7, however, localhost resolution is built into the DNS resolver, for reasons outlined here. This means that the IPv6 lookup will now succeed - but MySQL is not bound to that IPv6 address, so the connection will fail, and you will see the delay outlined in this question.

                那很好.只要告訴我如何修復它!

                您有幾個選擇.環顧互聯網,一般的解決方案"似乎是顯式使用 IP 地址而不是名稱,但有幾個原因不這樣做,兩者都與可移植性有關,兩者都可以說都不重要:

                You have a few options. Looking around the internet, the general "solution" seems to be to use the IP address explicitly instead of the name, but there are a couple of reasons not to do this, both portability related, both arguably not important:

                • 如果您將腳本移到另一臺支持 IPv6 的機器上,您的腳本將不再起作用.

                • If you move your script to another machine that only supports IPv6, your script will no longer work.

                如果您將腳本移至基于 *nix 的托管環境,則魔術字符串 localhost 將意味著 MySQL 客戶端更喜歡使用 Unix 套接字(如果已配置),這是比基于 IP 環回的連接更有效

                If you move your script to a *nix-based hosting environment, the magic string localhost would mean the MySQL client would prefer to use a Unix socket if one is configured, this is more efficient than IP loopback based connectivity

                它們聽起來很重要嗎?

                他們不是.您應該設計您的應用程序,以便在配置文件中定義此類內容.如果您將腳本移至其他環境,則可能還需要配置其他內容.

                They aren't. You should be designing your application so that this sort of thing is defined in a configuration file. If you move your script to another environment, chances are other things will need configuring as well.

                總而言之,使用 IP 地址不是最佳解決方案,但很可能是可接受的解決方案.

                In summary, using the IP address is not the best solution, but it is most likely an acceptable one.

                那么最好的解決方案是什么?

                最好的方法是更改?? MySQL 服務器使用的綁定地址.然而,這并不像人們想象的那么簡單.與 Apache、Nginx 和幾乎所有其他健全的網絡服務應用程序不同,MySQL 僅支持單個綁定地址,因此它不僅僅是添加另一個綁定地址的情況.幸運的是,操作系統確實在這里支持了一些魔法,因此我們可以讓 MySQL 同時使用 IPv4 和 IPv6.

                The best way would be to change the bind address that the MySQL server uses. However, this is not as simple as one might like. Unlike Apache, Nginx and almost every other sane network service application ever made, MySQL only supports a single bind address, so it's not just a case of adding another one. Luckily though, operating systems do support a bit of magic here, so we can enable MySQL to use both IPv4 and IPv6 simultaneously.

                您需要運行 MySQL 5.5.3 或更高版本,并且您需要使用 --bind-address= 命令行參數啟動 MySQL(或在 my.ini 中設置相應選項).您有 4 個選項docs,取決于你想做什么:

                You need to be running MySQL 5.5.3 or later, and you need to start MySQL with the --bind-address= command line argument (or set the corresponding option in my.ini). You have 4 optionsdocs, depending on what you want to do:

                • 您可能熟悉,并且最有可能(有效)使用的那個,0.0.0.0.這將綁定到機器上所有可用的 IPv4 地址.即使您不關心 IPv6,這實際上也可能不是最好的做法,因為它面臨與 :: 相同的安全風險.

                • The one you are probably familiar with, and the one that you are most likely (effectively) using, 0.0.0.0. This binds to all available IPv4 addresses on the machine. This actually is probably not the best thing to do even if you don't care about IPv6, as it suffers the same security risks as ::.

                顯式 IPv4 或 IPv6 地址(例如 127.0.0.1::1 用于環回).這會將服務器綁定到該地址并且該地址.

                An explicit IPv4 or IPv6 address (for example 127.0.0.1 or ::1 for loopback). This binds the server to that address and only that address.

                魔法字符串::.這將在 IPv4 和 IPv6 模式下將 MySQL 綁定到機器上的每個地址,包括環回和物理接口地址.這可能存在安全風險,僅當您需要 MySQL 接受來自遠程主機的連接時才這樣做.

                The magic string ::. This will bind MySQL to every address on the machine, both loopback and physical interface addresses, in IPv4 and IPv6 mode. This is potentially a security risk, only do this if you need MySQL to accept connections from remote hosts.

                使用IPv4 映射的 IPv6 地址.這是 IPv6 中內置的一種特殊機制,用于在 4 -> 6 轉換期間向后兼容,它允許您綁定到特定的 IPv4 地址,它與 IPv6 等效.除了雙環回"地址 ::ffff:127.0.0.1 之外,這對您不太可能有用.對于大多數人來說,這很可能是最好的解決方案,僅綁定到環回但允許 IPv4 和 IPv6 連接.

                Use an IPv4-mapped IPv6 address. This is a special mechanism built into IPv6 for backwards compatibility during the 4 -> 6 transition, and it allows you bind to a specific IPv4 address and it's IPv6 equivalent. This is quite unlikely to be useful to you for anything other than the "dual loopback" address ::ffff:127.0.0.1. This is most likely the best solution for most people, only binding to the loopback but allowing both IPv4 and IPv6 connections.

                我需要修改hosts文件嗎?

                .不要修改主機文件.DNS 解析器知道如何處理 localhost,重新定義它充其量沒有任何效果,最壞的情況是混淆解析器.

                NO. Don't modify the hosts file. The DNS resolver knows what to do with localhost, redefining it will at best have no effect, and at worst confuse the hell out of the resolver.

                <代碼>--skip-name-resolve?

                這也可能解決問題/需要解決問題,原因相關但略有不同.

                This may also fix the problem/be required to fix the problem, for a related but slightly different reason.

                如果沒有此配置選項,MySQL 將嘗試通過 PTR DNS 查詢將所有客戶端連接 IP 地址解析為主機名.如果您的 MySQL 服務器已經啟用使用 IPv6 但連接仍然需要很長時間,這可能是因為反向 DNS (PTR) 記錄沒有正確配置.

                Without this configuration option, MySQL will attempt to resolve all client connection IP addresses to a hostname via a PTR DNS query. If your MySQL server is already enabled to use IPv6 but connections are still taking a long time, it may be because the reverse DNS (PTR) record is not correctly configured.

                禁用名稱解析將解決此問題,但它確實有其他后果,特別是在 Host 條件中配置為使用 DNS 名稱的任何訪問權限現在都將失敗.

                Disabling name resolution will fix this problem, but it does have other ramifications, notably that any access permissions configured to use a DNS name in the Host condition will now fail.

                如果您打算這樣做,您需要將所有授權配置為使用 IP 地址而不是名稱.

                If you are going to do this, you will need to configure all your grants to use IP addresses instead of names.

                這篇關于PHP到EasyPHP MySQL服務器1秒連接延遲的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 中保持其類型?)

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

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

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

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

                          <bdo id='P2yy3'></bdo><ul id='P2yy3'></ul>
                        • 主站蜘蛛池模板: 扬州汇丰仪表有限公司| 艾默生变频器,艾默生ct,变频器,ct驱动器,广州艾默生变频器,供水专用变频器,风机变频器,电梯变频器,艾默生变频器代理-广州市盟雄贸易有限公司官方网站-艾默生变频器应用解决方案服务商 | 广东风淋室_广东风淋室厂家_广东风淋室价格_广州开源_传递窗_FFU-广州开源净化科技有限公司 | 锥形螺带干燥机(新型耙式干燥机)百科-常州丰能干燥工程 | 智成电子深圳tdk一级代理-提供TDK电容电感贴片蜂鸣器磁芯lambda电源代理经销,TDK代理商有哪些TDK一级代理商排名查询。-深圳tdk一级代理 | 传动滚筒_厂家-淄博海恒机械制造厂 | 过滤器_自清洗过滤器_气体过滤器_苏州华凯过滤技术有限公司 | bng防爆挠性连接管-定做金属防爆挠性管-依客思防爆科技 | 臭氧灭菌箱-油桶加热箱-原料桶加热融化烘箱-南京腾阳干燥设备厂 臭氧发生器_臭氧消毒机 - 【同林品牌 实力厂家】 | 艾乐贝拉细胞研究中心 | 国家组织工程种子细胞库华南分库 | 保温杯,儿童婴童奶瓶,运动水壶「广告礼品杯定制厂家」超朗保温杯壶 | 空调风机,低噪声离心式通风机,不锈钢防爆风机,前倾皮带传动风机,后倾空调风机-山东捷风风机有限公司 | 耐高温风管_耐高温软管_食品级软管_吸尘管_钢丝软管_卫生级软管_塑料波纹管-东莞市鑫翔宇软管有限公司 | MES系统工业智能终端_生产管理看板/安灯/ESOP/静电监控_讯鹏科技 | 折弯机-刨槽机-数控折弯机-数控刨槽机-数控折弯机厂家-深圳豐科机械有限公司 | 篷房[仓储-婚庆-展览-活动]生产厂家-江苏正德装配式帐篷有限公司 | 一氧化氮泄露报警器,二甲苯浓度超标报警器-郑州汇瑞埔电子技术有限公司 | 合肥汽车充电桩_安徽充电桩_电动交流充电桩厂家_安徽科帝新能源科技有限公司 | 定量包装机,颗粒定量包装机,粉剂定量包装机,背封颗粒包装机,定量灌装机-上海铸衡电子科技有限公司 | 东莞压铸厂_精密压铸_锌合金压铸_铝合金压铸_压铸件加工_东莞祥宇金属制品 | 高铝矾土熟料_细粉_骨料_消失模_铸造用铝矾土_铝酸钙粉—嵩峰厂家 | 微妙网,专业的动画师、特效师、CG模型设计师网站! - wmiao.com 超声波电磁流量计-液位计-孔板流量计-料位计-江苏信仪自动化仪表有限公司 | 广州展览制作工厂—[优简]直营展台制作工厂_展会搭建资质齐全 | 浙江华锤电器有限公司_地磅称重设备_防作弊地磅_浙江地磅售后维修_无人值守扫码过磅系统_浙江源头地磅厂家_浙江工厂直营地磅 | 悬浮拼装地板_幼儿园_篮球场_悬浮拼接地板-山东悬浮拼装地板厂家 | 全温度恒温培养摇床-大容量-立式-远红外二氧化碳培养箱|南荣百科 | 卸料器-卸灰阀-卸料阀-瑞安市天蓝环保设备有限公司 | 大通天成企业资质代办_承装修试电力设施许可证_增值电信业务经营许可证_无人机运营合格证_广播电视节目制作许可证 | 实验室隔膜泵-无油防腐蚀隔膜泵-耐腐蚀隔膜真空泵-杭州景程仪器 电杆荷载挠度测试仪-电杆荷载位移-管桩测试仪-北京绿野创能机电设备有限公司 | 三轴曲线机-端子插拔力试验机|华杰仪器 | 北京乾茂兴业科技发展有限公司 | 中视电广_短视频拍摄_短视频推广_短视频代运营_宣传片拍摄_影视广告制作_中视电广 | 冷却塔风机厂家_静音冷却塔风机_冷却塔电机维修更换维修-广东特菱节能空调设备有限公司 | 超高频感应加热设备_高频感应电源厂家_CCD视觉检测设备_振动盘视觉检测设备_深圳雨滴科技-深圳市雨滴科技有限公司 | 冻干机(冷冻干燥机)_小型|实验型|食品真空冷冻干燥机-松源 | 工业车间焊接-整体|集中除尘设备-激光|等离子切割机配套除尘-粉尘烟尘净化治理厂家-山东美蓝环保科技有限公司 | 红立方品牌应急包/急救包加盟,小成本好项目代理_应急/消防/户外用品加盟_应急好项目加盟_新奇特项目招商 - 中红方宁(北京) 供应链有限公司 | 电子元器件呆滞料_元器件临期库存清仓尾料_尾料优选现货采购处理交易商城 | 南京种植牙医院【官方挂号】_南京治疗种植牙医院那个好_南京看种植牙哪里好_南京茀莱堡口腔医院 尼龙PA610树脂,尼龙PA612树脂,尼龙PA1010树脂,透明尼龙-谷骐科技【官网】 | 细石混凝土泵_厂家_价格-烟台九达机械有限公司 | 耐火浇注料-喷涂料-浇注料生产厂家_郑州市元领耐火材料有限公司 耐力板-PC阳光板-PC板-PC耐力板 - 嘉兴赢创实业有限公司 |