Instalação

Installing PDO on Unix systems
  1. PDO and the PDO_SQLITE driver is enabled by default as of PHP 5.1.0. 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.

    Nota:

    When building PDO as a shared extension (not recommended) then all PDO drivers must be loaded after PDO itself.

  2. When installing PDO as a shared module, the php.ini file needs to be updated so that the PDO extension will be loaded automatically when PHP runs. You will also need to enable any database specific drivers there too; make sure that they are listed after the pdo.so line, as PDO must be initialized before the database-specific extensions can be loaded. If you built PDO and the database-specific extensions statically, you can skip this step.

    extension=pdo.so
    

Windows users
  1. PDO and all the major drivers ship with PHP as shared extensions, and simply need to be activated by editing the php.ini file:

    extension=php_pdo.dll
    

    Nota:

    This step is not necessary for PHP 5.3 and above, as a DLL is no longer required for PDO.

  2. Next, choose the other database-specific DLL files and either use dl() to load them at runtime, or enable them in php.ini below php_pdo.dll. For example:

    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  
    

    These DLLs should exist in the system's extension_dir.

Nota:

Remember that after making changes to your php.ini file you will need to restart PHP for your new configuration directives to take effect.

add a note add a note

User Contributed Notes 3 notes

up
-9
bimal at sanjaal dot com
1 year ago
On Raspbian (Raspberry Pi), it is installable as:

sudo apt-get install php-mysql

The ini files are auto updated.
up
-42
jean dot ferreira at gmail dot com
5 years 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
-44
kamil
4 years ago
If you do need to install because your distribution does not include it by default (for example PHP 5.5 on Centos), use

yum install php-pdo
To Top