PHP 5.4.33 Released

Installation

PDO auf Unix-Systemen installieren
  1. PDO und der PDO_SQLITE Treiber sind seit PHP 5.1.0 standardmäßig aktiviert. Zusätzlich müssen Sie eventuell den PDO-Treiber für die Datenbank Ihrer Wahl aktivieren. Ziehen Sie die Dokumentation für datenbankspezifische PDO-Treiber zu Rate, um mehr darüber zu erfahren. Beachten Sie: Wenn Sie PDO als Shared Extension (nicht empfohlen) kompilieren, müssen alle PDO-Treiber nach PDO selbst geladen werden.

  2. Wenn PDO als Shared Module installiert wurde, muss die php.ini-Datei dahingehend geändert werden, dass die PDO-Erweiterung automatisch geladen wird, wenn PHP ausgeführt wird. Sie müssen dort auch alle datenbankspezifischen Treiber aktivieren. Versichern Sie sich, dass diese nach der Zeile mit pdo.so stehen, da PDO initialisiert werden muss, bevor die datenbankspezifischen Erweiterungen geladen werden können. Wenn Sie PDO und die datenbankspezifischen Erweiterungen statisch kompiliert haben, können Sie diesen Schritt überspringen.

    extension=pdo.so
    

Installation auf Windows
  1. PDO und alle gängigen Treiber werden mit PHP als Shared Module mitgeliefert und müssen nur durch Bearbeiten der Datei php.ini aktiviert werden:

    extension=php_pdo.dll
    

    Hinweis:

    Dieser Schritt ist seit PHP 5.3 nicht mehr notwendig, da für PDO keine DLL mehr benötigt wird.

  2. Als nächstes wählen Sie die datenbankspezifischen DLL-Dateien und laden sie entweder per dl() zur Laufzeit oder aktivieren sie in der Datei php.ini unterhalb von php_pdo.dll. Zum Beispiel:

    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
    

    Diese DLLs sollten im extension_dir des Systems vorhanden sein.

add a note add a note

User Contributed Notes 3 notes

up
3
gerrywastaken
4 years ago
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.
up
0
jean dot ferreira at gmail dot com
5 months ago
==Installation pdo_ibm in PHP5, using Data Server Driver Package on Debian / Ubuntu==

==Advantages==
#You do not need DB2 (database) installed

==Steps==
#1- Install packages
apt-get install ksh, php5-dev

#2- Make directory
mkdir /opt/ibm

#3- Download Data Server Driver Package (dsdriver), as the architecture
(https://www-304.ibm.com/support/docview.wss?rs=4020&uid=swg27016878&wv=1)

#4- Decompress dsdriver at /opt/ibm/
tar -xvf v10.5fp1_linuxx64_dsdriver.tar.gz  (linux64)
or
tar -xvf v10.5fp1_linuxia32_dsdriver.tar.gz (linux32)

#5- Change permission -  /opt/ibm/dsddriver and run the installation script
chmod 755 installDSDriver
ksh installDSDriver

#6 Download the PDO IBM driver from http://pecl.php.net/package/PDO_IBM and untar the file
http://pecl.php.net/get/PDO_IBM-1.3.3.tgz
tar -xvf PDO_IBM-1.3.3.tgz

#7 Change to the PDO_IBM-1.3.3 directory (that contains the config.m4 file) and execute 'phpize'
cd /xxxx/PDO_IBM-1.3.3
phpize

#8 Configure, make and make install
./configure --with-pdo-ibm=/opt/ibm/dsdriver/lib
make
make install

#9- Change php.ini
vim /etc/php5/apache2/php.ini
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
extension = pdo_ibm.so

#10- Reboot the Apache
service apache2 restart
up
-3
dtcwee at hotmail dot com
3 years ago
You may receive this error when testing a PDO-ODBC connection:

"The specified DSN contains an architecture mismatch between the Driver and Application"

My environment was Windows 7 (64 bit), MySQL ODBC drivers (64 bit), Apache 2.2.17 (32 bit), PHP 5.3.5 (32 bit).

If you are like me, you were testing the PDO-ODBC connection because the native database drivers were not visible to PHP. Furthermore, the MySQL 32 bit drivers did not work in my environment.

Solution: Your environment has to be 64 bit all the way through.

Install 64 bit versions of Apache and PHP. They are not available from official sources. However, kind people have compiled some and made them available for download.

As a bonus, the native database drivers suddenly showed up enabled.
To Top