downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

実行時設定> <要件
Last updated: Fri, 13 Nov 2009

view this page in

インストール手順

Unix システムへの PDO のインストール
  1. PDO および PDO_SQLITE ドライバは、PHP 5.1.0 以降デフォルトで有効となっています。 必要に応じて、使用するデータベース用の PDO ドライバを有効にすることができます。 データベースごとの PDO ドライバについてのドキュメント を参照ください。 注意: PDO を共有モジュールとしてビルドする場合 (非推奨です)、 すべての PDO ドライバは PDO 自体の後に ロードしなければなりません。

  2. PDO を共有モジュールとしてインストールする場合は、php.ini ファイルを変更し、PHP の実行時に PDO 拡張モジュールが自動的に読み込まれるようにしなければなりません。 データベースごとのドライバについても同様です。 ドライバは、pdo.so ファイルの後に記述するようにしましょう。 ドライバを読み込む前に PDO の初期化を済ませておく必要があるからです。 PDO およびデータベースドライバを静的にビルドした場合は、この部分は読み飛ばしてかまいません。

    extension=pdo.so
    

Windows ユーザ
  1. PDO および主要なドライバは、共有モジュールとして PHP に同梱されています。 単純に php.ini ファイルを編集するだけで使用可能です。

    extension=php_pdo.dll
    

  2. 次に、その他のデータベース固有の DLL について、実行時に dl() で読み込むか php.ini の中で php_pdo.dll に引き続いて指定します。たとえば次のようになります。

    extension=php_pdo.dll
    extension=php_pdo_firebird.dll
    extension=php_pdo_informix.dll
    extension=php_pdo_mssql.dll
    extension=php_pdo_mysql.dll
    extension=php_pdo_oci.dll
    extension=php_pdo_oci8.dll
    extension=php_pdo_odbc.dll
    extension=php_pdo_pgsql.dll
    extension=php_pdo_sqlite.dll  
    

    これらの DLL は、システムの extension_dir になければなりません。



実行時設定> <要件
Last updated: Fri, 13 Nov 2009
 
add a note add a note User Contributed Notes
インストール手順
gerrywastaken
13-Nov-2009 08:13
This page states
"You may need to enable the PDO driver for your database of choice; consult the documentation for [database-specific PDO drivers]  to find out more about that."

With the term "database-specific PDO drivers" being a link to this information. However you will no find this information on that or any of the pages that it in turn links to.

The appropriate config options seems to be only available by running ./config --help from the source directory after running autoconf.

Here is the related output from running that command:
=====================
  --with-pdo-dblib[=DIR]    PDO: DBLIB-DB support.  DIR is the FreeTDS home directory
  --with-pdo-firebird[=DIR] PDO: Firebird support.  DIR is the Firebird base
                            install directory [/opt/firebird]
  --with-pdo-mysql[=DIR]    PDO: MySQL support. DIR is the MySQL base directoy
                                 If mysqlnd is passed as DIR, the MySQL native
                                 native driver will be used [/usr/local]
  --with-zlib-dir[=DIR]       PDO_MySQL: Set the path to libz install prefix
  --with-pdo-oci[=DIR]      PDO: Oracle OCI support. DIR defaults to $ORACLE_HOME.
                            Use --with-pdo-oci=instantclient,prefix,version
                            for an Oracle Instant Client SDK.
                            For Linux with 10.2.0.3 RPMs (for example) use:
                            --with-pdo-oci=instantclient,/usr,10.2.0.3
  --with-pdo-odbc=flavour,dir
                            PDO: Support for 'flavour' ODBC driver.
                            include and lib dirs are looked for under 'dir'.
                           
                            'flavour' can be one of:  ibm-db2, iODBC, unixODBC, generic
                            If ',dir' part is omitted, default for the flavour
                            you have selected will used. e.g.:
                           
                              --with-pdo-odbc=unixODBC
                             
                            will check for unixODBC under /usr/local. You may attempt
                            to use an otherwise unsupported driver using the "generic"
                            flavour.  The syntax for generic ODBC support is:
                           
                              --with-pdo-odbc=generic,dir,libname,ldflags,cflags

                            When build as shared the extension filename is always pdo_odbc.so
  --with-pdo-pgsql[=DIR]    PDO: PostgreSQL support.  DIR is the PostgreSQL base
                            install directory or the path to pg_config
  --without-pdo-sqlite[=DIR]
                            PDO: sqlite 3 support.  DIR is the sqlite base
                            install directory [BUNDLED]
=====================

So if you wish for instance to install the PostgreSQL PDO driver, then you should add the --with-pdo-pgsql config option before compiling PHP. I may have made mistakes in my explination, however it appears to work and was my best guess given the absence of the mentioned documentation.
it at lanar dot com dot au
07-Jun-2009 09:06
To add from windows, simply use add/remove programs to change the PHP installation and select the PDO features required.
f3ath at lamak dot ru
26-Jul-2008 09:28
To install PDO MySql in Debian/Ubuntu systems run:

sudo aptitude install libmysqlclient-dev
sudo pecl install pdo
sudo pecl install pdo_mysql

実行時設定> <要件
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites