LoginSignup
0
2

More than 5 years have passed since last update.

CodeIgniter 3 でmysql 4.0 に接続

Last updated at Posted at 2016-12-02

mysql 4.0 に CodeIgniter 3で接続が出来ないと思って
(入門) CodeIgniter 2 でdatabase接続 - Qiitaを書いていたが、
CodeIgniter 3でも接続する方法がわかった。
サーバ要件 — CodeIgniter 3.2.0-dev ドキュメント (MySQL(5.1+)、mysql*(廃止予定))

設定

  • php 5.6にて確認。
config/database.php
- 'dbdriver' => 'mysqli',
+ 'dbdriver' => 'mysql',

あとの方法は CodeIgniter 2 と同じ。

E_DEPRECATED のエラーを抑止

aa.png

system/database/drivers/mysql/mysql_driver.php
 // Error suppression is necessary mostly due to PHP 5.5+ issuing E_DEPRECATED messages
 $this->conn_id = ($persistent === TRUE)
         ? mysql_pconnect($this->hostname, $this->username, $this->password, $client_flags)
-        : mysql_connect($this->hostname, $this->username, $this->password, TRUE, $client_flags);
+        : @mysql_connect($this->hostname, $this->username, $this->password, TRUE, $client_flags);
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2