You are viewing revision #6 of this wiki article.
This is the latest version of this article.
You may want to see the changes made in this revision.
These are the steps to install pdo_oci ¶
From: http://lacot.org/ and me.
~$ > sudo apt-get install apache2 php5 php5-cli php5-xdebug php5-memcache php5-mcrypt php5-imagick php5-gd php5-xsl subversion imagemagick unzip htop memcached
~$ > sudo apt-get install php5-dev ~$ > sudo apt-get install php-pear
Install the libraries from "Oracle Instant Client" Go to the site and download:
Oracle instant client basic 10.2.0.4, file zip
Oracle instant client sdk 10.2.0.4, file zip
Put both files in /tmp
~$ > cd /tmp/
~$ > unzip oracle-instantclient-basic-10.2.0.4-1.i386.zip
~$ > mv instantclient_10_2 /opt/
~$ > unzip oracle-instantclient-devel-10.2.0.4-1.i386.zip
~$ > mv instantclient_10_2/sdk /opt/instantclient_10_2/
~$ > export ORACLE_HOME=/opt/instantclient_10_2/
~$ > ln -s /opt/instantclient_10_2/libclntsh.so.10.1 /opt/instantclient_10_2/libclntsh.so
~$ > ln -s /opt/instantclient_10_2/libocci.so.10.1 /opt/instantclient_10_2/libocci.so
~$ > ln -s /opt/instantclient_10_2/ /opt/instantclient_10_2/lib
~$ > pecl download pdo PDO_OCI OCI8
~$ > tar xzvf PDO-1.0.3.tgz (the version can vary)
~$ > tar xzvf oci8-1.4.1.tgz
~$ > tar xzvf PDO_OCI-1.0.tgz
install "re2c 0.12.0 or later". i've done wiht the package manager, but I think is something like
~$ > apt-get install re2c
~$ > cd PDO-1.0.3
~$ > phpize
~$ > ./configure
~$ > make
~$ > sudo make install
~$ > cd ../oci8-1.4.1
~$ > phpize
~$ > ./configure --with-oci8=instantclient,/opt/instantclient_10_2/
~$ > make
~$ > sudo make install
~$ > cd ../PDO_OCI-1.0
~$ > cp /opt/instantclient_10_2/sdk/include/*.h .
~$ > phpize
~$ > ./configure
~$ > make
~$ > sudo make install
And then, you can verify with: ¶
<?php phpinfo(); ?>
After that, you can configure the connection in config/main.php
'db'=> array(
'class'=> 'CDbConnection',
'connectionString'=> 'oci:dbname=10.XX.XX.XX/xe',
'username'=> 'USER_NAME',
'password'=> 'your_passsword'
),
And, if some error of this style appears: ¶
exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 942 OCIStmtExecute: ORA-00942: table or view does not exist (/tmp/PDO_OCI-1.0/oci_statement.c:142)
is because of that: Bug 20/04/10
others errors ¶
configure: error: Cannot find php_pdo_driver.h.
~$ > cd /usr/include
~$ > sudo ln -s php5 php
You are done!!!
thanks PoL
Alternative
If you are facing problems installing pdo_oci or are forced not to use this experimental driver, you can safely use oci8 driver through this extension: http://www.yiiframework.com/extension/phppdo/
Both drivers works well with Yii's ActiveRecord, tested :)
Perhaps this helps
Try this:
https://github.com/thiagoluis/install-pdo-oci
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.