rakutoネット
お問合せ 免責事項 Q&A 掲示板 サイト管理 リンク サイトマップ
HOME > PDO(PHP Data Objects)とは

PDO(PHP Data Objects)とは


WindowsでのPDO+SQLiteセットアップ

PHPはすでにインストールされているものとします。
PHP Snapshotsにあるver5.x以上のWin32 Packageをダウンロードします。

  PHPのバージョンとdllのバージョンが一致しない場合にエラーが起こるようです。
  該当するバージョンのCollection of PECL modulesをダウンロードして必要なdllを取得してください。

必要なDLLファイルはphp_pdo.dllとphp_pdo_sqlite.dllの2つのファイルです。
それを「ext」フォルダに保存します。
    例)C:wwwphpext
次に「WINDOWS」フォルダにある「php.ini」ファイルを変更します。
    (phpに付属している「php.ini-dist」を名前を変えて「WINDOWS」フォルダにコピー)
変更個所は二行で「extension_dir」に「php_pdo.dll」「php_pdo_sqlite.dll」を保存したパスを入力します。
更に、以下の行を追加します。
extension=php_pdo.dll
extension=php_pdo_sqlite.dll

; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:wwwphpext"

extension=php_pdo.dll
extension=php_pdo_sqlite.dll

修正後httpdプロセスを再起動させます。

LinuxでのPDOセットアップ

パッケージのインストール
LinuxへのインストールはDo You PHP?さんをご覧頂くのが良いかと思います。

--------------------------------
今回インストールした環境
  OS:VineLinux3.1
  Apache2-2.0.5
  php5-5.0.3
--------------------------------
PHPはコンパイルせずにrpmでインストールしました。
extension_dirはデフォルトの/usr/lib/php5/です。

上手く動くか?pdo.tgzこれを使うのは自己責任でお願いします。

PHPはすでにインストールされているものとします。
Do You PHP?さんのページを見ながらインストール作業をしてみました。
$ pear download pdo
$ tar xzvf PDO-0.2.4.tgz
$ cd PDO-0.2.4
$ phpize

Configuring for:
PHP Api Version:         20031224
Zend Module Api No:      20041030
Zend Extension Api No:   220040412
Do You PHP?さんの所で、ご指摘されていた通りwarningが沢山でました。
私は、気にせず続けました。

$./configure

何か色々でる……
ここでも特にオプションは指定していません。

$ make

----------------------------------------------------------------------
Libraries have been installed in:
   /var/tmp/pear-build-root/PDO-0.2.4/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).

# make install

Installing shared extensions:     /usr/lib/php5/
Installing PDO headers:          /usr/include/php/ext/pdo/

----------------------------------
まず、PDOが完成。
php.iniの変更
extension = pdo.so

php.iniをここで変更しました。
pdo_sqliteのインストール時にエラーがでました。
php.iniの設定が原因だったのか分からないのですが、設定したらエラーがなくなりました。

LinuxでのPDO_SQLiteセットアップ

パッケージのインストール
$ pear download pdo_sqlite
# pear install PDO_SQLITE-0.2.2tgz

----------------------------------------------------------------------
Libraries have been installed in:
   /var/tmp/pear-build-root/PDO_SQLITE-0.2.2/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).

pdo_sqlite.so copied to /tmp/tmpfXTRMX/PDO_SQLITE-0.2.2/pdo_sqlite.so

Build process completed successfully
Installing 'pdo_sqlite.so' at ext_dir (/usr/lib/php5/pdo_sqlite.so)
install ok: PDO_SQLITE 0.2.2
pdo_sqliteはpearコマンドからインストールできました。
pdoのセットアップの所で書きましたが、pdoがインストールされていないと以下のエラーがでました。
'pdo' PHP extension is not installed
PDO_SQLITE: Dependencies failed

多分php.iniの設定でエラーが取れたと思います。
php.iniの変更
extension = pdo.so
extension = pdo_sqlite.so

pdo_sqlite.soを追加します。

インストールの確認

phpinfo()を実行し、以下の情報が表示されればインストールは完了です。
<?php
phpinfo();
?>

PDO

pdo supportenabled

DirectiveLocal ValueMaster Value
pdo.global_value4242

pdo_sqlite

PDO Driver for SQLite 3.xenabled
PECL Module version 0.1-dev $Id: pdo_sqlite.c,v 1.1 2004/09/19 10:55:41 wez Exp $
SQLite Library 3.0.7




PDOでSQLite!! PDOの概要>>

PHPリング

@PHP.ring Home
<5 <1 Random List 1> 5>

rktSQLite

  • sourceforge.jp

広告


アマゾン検索

サーチ:
Amazon.co.jpアソシエイト

カテゴリ

  •  Templateエンジンのすすめ Templateエンジンのすすめ
  •  SQLiteをやってみよう SQLiteをやってみよう
  •  SQLite SQLコマンド一覧 SQLiteコマンド一覧
  •  SQLite 管理プログラムSQLite 管理
  •  はじめてのEclipse はじめてのEclipse
  •  PHP SQLiteのTIPS PHP SQLiteのTIPS
  •  サンプル サンプル/ダウンロード
  •  リンク リンク
  •  掲示板 掲示板

メニュー

  •  PDO(PHP Data Objects)とは
  •  PDOの概要
  •  PDOクラスリファレンス
  •  データベースハンドルクラス
  •  ステートメントクラス

キーワード検索

キーワード



最近のTB

  •  2006/03/13さくらのブログに挑戦[rakutoネットブログ]
  •  2006/01/20レーザーチャートの作成方法[脳内研究所]

Summary

  •     ATOM(XML)
  •     RDF(XML)
  •     RSS0.92(XML)
  •     RSS2.0(XML)

Powered by

  •     PHP
  •     Smarty
  •     SQLite
  •     MySQL
Copyright (C) 2005 `rakuto.net' All Rights Reserved.