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

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

    • <bdo id='Ub98r'></bdo><ul id='Ub98r'></ul>
  • <legend id='Ub98r'><style id='Ub98r'><dir id='Ub98r'><q id='Ub98r'></q></dir></style></legend>

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

      1. <tfoot id='Ub98r'></tfoot>

        LOAD DATA LOCAL INFILE 在 php 5.5 中使用 PDO 不起作用

        LOAD DATA LOCAL INFILE does not work from php 5.5 using PDO(LOAD DATA LOCAL INFILE 在 php 5.5 中使用 PDO 不起作用)

        • <bdo id='WEAmd'></bdo><ul id='WEAmd'></ul>

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

              <legend id='WEAmd'><style id='WEAmd'><dir id='WEAmd'><q id='WEAmd'></q></dir></style></legend>
              <tfoot id='WEAmd'></tfoot>

                    <tbody id='WEAmd'></tbody>
                  本文介紹了LOAD DATA LOCAL INFILE 在 php 5.5 中使用 PDO 不起作用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我最近移動了網絡服務器,新的網絡服務器有不同版本的 PHP.

                  I've recently moved web servers, and the new web server has a different version of PHP.

                  新服務器:PHP 5.5.3-1ubuntu2 (cli)舊服務器:PHP 5.3.10 (cli)

                  New Server: PHP 5.5.3-1ubuntu2 (cli) Old Server: PHP 5.3.10 (cli)

                  在數據庫服務器上,my.cnf 設置為允許 local-infile.我可以從以下位置使用加載數據本地 infile:

                  On the database server, my.cnf is set to allow local-infile. I can use load data local infile from:

                  - HeidiSQL
                  - The command line client running on the new web server using --local-infile=1
                  - PHP, using PDO, from the old web server
                  

                  但是,當我嘗試從新的 Web 服務器連接時,使用帶有 PDO 的 PHP,我得到:出現數據庫問題:SQLSTATE[42000]: Syntax error or access conflict: 1148 The used command is not allowed with this MySQL version

                  However, when I try to connect from the new web server, using PHP with PDO, I get: A database problem has occurred: SQLSTATE[42000]: Syntax error or access violation: 1148 The used command is not allowed with this MySQL version

                  php.ini:

                  [MySQL]
                  ; Allow accessing, from PHP's perspective, local files with LOAD DATA statements
                  ; http://php.net/mysql.allow_local_infile
                  mysql.allow_local_infile = On
                  

                  PDO 構造函數:

                  $this->db_conn = new PDO("mysql:host=$host;dbname=$dbname;port=$port", $user, $pass, array(PDO::MYSQL_ATTR_LOCAL_INFILE => 1));
                  

                  我也在 PHP 腳本中嘗試過 ini_set('mysql.allow_local_infile', 1) 和 ini_set('mysql.allow_local_infile', true).

                  I've also tried ini_set('mysql.allow_local_infile', 1) and ini_set('mysql.allow_local_infile', true) in the PHP script.

                  需要 LOCAL 關鍵字,因為文件托管在 Web 服務器上,而不是數據庫服務器上.

                  The LOCAL keyword is needed because the files are hosted on the web server, not the database server.

                  PHP 5.5 還想從我這里得到什么?

                  What else does PHP 5.5 want from me?

                  推薦答案

                  您需要同時配置客戶端和服務器以允許此命令:

                  You need to configure both the client and the server to allow this command:

                  1. 確保服務器允許 LOAD DATA LOCAL INFILE.在 MySQL 服務器上編輯/etc/my.cnf:

                  1. Make sure the server allows LOAD DATA LOCAL INFILE. Edit /etc/my.cnf on the MySQL server:

                  [server]
                  local-infile=1
                  

                • 在您的 PHP 腳本中設置 PDO 屬性:

                • Set the PDO attribute in your PHP script:

                  <?php
                  
                  $dsn = "mysql:host=localhost;dbname=test";
                  $user = "root";
                  $password = "root";
                  $pdo = new PDO($dsn, $user, $password, array(PDO::MYSQL_ATTR_LOCAL_INFILE=>1));
                  $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                  
                  $pdo->exec("LOAD DATA LOCAL INFILE 'foo.csv' INTO TABLE foo FIELDS TERMINATED BY ','");
                  

                  這需要在構造函數的驅動程序選項參數中設置,而不是在對 setAttribute() 的后續調用中設置.

                  This needs to be set in the driver options argument to the constructor, not in a subsequent call to setAttribute().

                  我剛剛在 CentOS Linux 6.5 上使用 PHP 5.5.8 和 Percona Server 5.6.15 成功測試了上述代碼示例.

                  I just tested the above code example successfully with PHP 5.5.8 and Percona Server 5.6.15 on CentOS Linux 6.5.

                  如果您仍然遇到問題,您可能有一個不允許 local-infile 的 MySQL 客戶端或 PDO 版本.http://dev.mysql 中描述了這些要求.com/doc/refman/5.6/en/load-data-local.html

                  If you still have trouble, you may have a build of the MySQL client or PDO that does not permit local-infile. The requirements are described in http://dev.mysql.com/doc/refman/5.6/en/load-data-local.html

                  php.ini 中的 mysql.allow_local_infile 選項與 PDO 無關.

                  The mysql.allow_local_infile option in your php.ini is not relevant to PDO.

                  這篇關于LOAD DATA LOCAL INFILE 在 php 5.5 中使用 PDO 不起作用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

                  1. <tfoot id='a3PF2'></tfoot><legend id='a3PF2'><style id='a3PF2'><dir id='a3PF2'><q id='a3PF2'></q></dir></style></legend>

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

                    <i id='a3PF2'><tr id='a3PF2'><dt id='a3PF2'><q id='a3PF2'><span id='a3PF2'><b id='a3PF2'><form id='a3PF2'><ins id='a3PF2'></ins><ul id='a3PF2'></ul><sub id='a3PF2'></sub></form><legend id='a3PF2'></legend><bdo id='a3PF2'><pre id='a3PF2'><center id='a3PF2'></center></pre></bdo></b><th id='a3PF2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='a3PF2'><tfoot id='a3PF2'></tfoot><dl id='a3PF2'><fieldset id='a3PF2'></fieldset></dl></div>
                      <tbody id='a3PF2'></tbody>
                        • <bdo id='a3PF2'></bdo><ul id='a3PF2'></ul>
                            主站蜘蛛池模板: 成人在线视频一区 | 亚洲成人一区 | 日韩在线 | 亚洲欧美一区二区在线观看 | 亚洲国产高清免费 | 欧美一区二区三区视频 | 国内自拍视频在线观看 | 天天操夜夜爽 | 国产免费拔擦拔擦8x高清 | 丝袜一区二区三区 | 一区二区三区视频 | 99这里只有精品视频 | 7799精品视频天天看 | 国产91在线播放 | 男人的天堂avav | 久久美国| 在线国产一区二区 | 7777在线视频免费播放 | 成人在线视频免费看 | 国产精品爱久久久久久久 | 日本精品久久久久久久 | 91精品一区| 亚洲一区二区三区四区五区中文 | 超碰超碰 | 亚洲 精品 综合 精品 自拍 | 91国内外精品自在线播放 | 欧美一区二区三区久久精品 | 国产精品久久久久久久 | 欧美aaaaa| 欧美日韩在线一区二区三区 | 国产精品久久久久久久久久久久久久 | 欧美在线综合 | 欧美日韩在线免费 | 九色国产 | 色资源在线观看 | 中文字幕视频一区二区 | 自拍偷拍亚洲欧美 | 最新国产福利在线 | 国产一区二区免费 | 欧美综合在线视频 | 黄视频网址 |