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

search for in the

Configuration à l'exécution> <Pré-requis
[edit] Last updated: Fri, 17 May 2013

view this page in

Installation

PHP 5.1 et supérieur sur les systèmes Unix
  1. PDO et le driver PDO_SQLITE sont activés par défaut depuis PHP 5.1.0. Vous devez activer le driver PDO de la base de données de votre choix ; consultez la documentation pour les drivers spécifiques à votre base de données pour plus d'informations.

    Note:

    Notez que lors de la compilation de PDO comme extension partagée (non recommandé), alors tous les drivers PDO doivent être chargés après le chargement de PDO.

  2. Lors de l'installation de PDO comme module partagé, le fichier php.ini doit être mis à jour afin de charger l'extension PDO automatiquement lorsque PHP entre en fonctionnement. Vous devez également y activer les drivers spécifiques à votre base de données ; assurez-vous que ces drivers seront listés après la ligne pdo.so, vu que PDO doit être initialisé avant le chargement des extensions spécifiques aux bases de données. Si vous compilez PDO et les extensions relatives aux bases de données de façon statique, vous pouvez ignorer cette étape.

    extension=pdo.so
    

Utilisateurs de Windows
  1. PDO ainsi que tous les drivers principaux interagissent avec PHP en tant qu'extensions partagées, et ont tout simplement besoin d'être activés en éditant le fichier php.ini :

    extension=php_pdo.dll
    

    Note:

    Cette étape n'est plus nécessaire depuis PHP 5.3, PDO ne requière plus de DLL.

  2. Ensuite, choisissez les autres fichiers DLL spécifiques à votre base de données et utilisez soit la fonction dl() pour les charger au moment de l'exécution ou activer-les dans le fichier php.ini en dessous de la ligne php_pdo.dll. Par exemple :

    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  
    

    Ces bibliothèques DDLs doivent exister dans le dossier système extension_dir.

Note:

Gardez à l'esprit qu'après modifications de votre php.ini, vous devez re-démarrer PHP pour que vos nouvelles directives de configuration prennent effet.



Configuration à l'exécution> <Pré-requis
[edit] Last updated: Fri, 17 May 2013
 
add a note add a note User Contributed Notes Installation - [3 notes]
up
3
dtcwee at hotmail dot com
2 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.
up
2
gerrywastaken
3 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
it at lanar dot com dot au
3 years ago
To add from windows, simply use add/remove programs to change the PHP installation and select the PDO features required.

 
show source | credits | sitemap | contact | advertising | mirror sites