Page 1 of 1

Building pdo_oci.so for XAMPP Linux 1.7.3a

PostPosted: 13. January 2010 20:49
by superpoke
I didn't find the pdo_oci.so driver in the XAMPP Linux 1.7.3a distribution which I needed for a project. Here are the steps I took to compile it -- hopefully this will help someone else.

* Download the complete source code for PHP 5.3.1 from http://www.php.net and place it in /tmp

* Download the following Oracle Instant Client 10.2.0.4 packages from http://www.oracle.com/technology/softwa ... xsoft.html and place them in /tmp:

oracle-instantclient-basic-10.2.0.4-1.i386.zip
oracle-instantclient-devel-10.2.0.4-1.i386.zip

You will need to register for an Oracle OTN account (free) to access the url and download the libraries.

* Unpack the downloaded files
cd /tmp
unzip oracle-instantclient-basic-10.2.0.4-1.i386.zip
unzip oracle-instantclient-devel-10.2.0.4-1.i386.zip
tar -zxvf php-5.3.1.tar.gz

* Move the Oracle library files to the right place
mv instantclient_10_2 /opt/lampp/lib

* Create necessary symlinks
cd /opt/lampp/lib
ln -s /opt/lampp/lib/instantclient_10_2 instantclient
ln -s /opt/lampp/lib/instantclient_10_2 lib
ln -s /opt/lampp/lib/instantclient_10_2/libclntsh.so.10.1 libclntsh.so
ln -s /opt/lampp/lib/instantclient_10_2/libocci.so.10.1 libocci.so

* Set your ORACLE_HOME
export ORACLE_HOME=/opt/lampp/lib/instantclient

* Prepare to compile pdo_oci.so in the PHP tree
cd /tmp/php-5.3.1

* Configure PHP 5.3.2 You need to configure PHP with the switches to inform the builder of the location of LAMPP and the Oracle Instantclient that you just installed. To do this, I copied the configure command that is returned by phpinfo() and added the pdo-oci switches. The command is as follows

'./configure' '--prefix=/opt/lampp' '--with-apxs2=/opt/lampp/bin/apxs' '--with-config-file-path=/opt/lampp/etc' '--with-mysql=mysqlnd' '--enable-inline-optimization' '--disable-debug' '--enable-bcmath' '--enable-calendar' '--enable-ctype' '--enable-dbase' '--enable-discard-path' '--enable-exif' '--enable-filepro' '--enable-force-cgi-redirect' '--enable-ftp' '--enable-gd-imgstrttf' '--enable-gd-native-ttf' '--with-ttf' '--enable-magic-quotes' '--enable-memory-limit' '--enable-shmop' '--disable-sigchild' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-wddx' '--enable-yp' '--with-ftp' '--with-gdbm=/opt/lampp' '--with-jpeg-dir=/opt/lampp' '--with-png-dir=/opt/lampp' '--with-freetype-dir=/opt/lampp' '--without-xpm' '--with-zlib=yes' '--with-zlib-dir=/opt/lampp' '--with-openssl=/opt/lampp' '--with-expat-dir=/opt/lampp' '--enable-xslt=/opt/lampp' '--with-xsl=/opt/lampp' '--with-dom=/opt/lampp' '--with-ldap=/opt/lampp' '--with-ncurses=/opt/lampp' '--with-gd' '--with-imap-dir=/opt/lampp' '--with-imap-ssl' '--with-imap=/opt/lampp' '--with-gettext=/opt/lampp' '--with-mssql=/opt/lampp' '--with-sybase-ct=/opt/lampp' '--with-mysql-sock=/opt/lampp/var/mysql/mysql.sock' '--with-oci8=shared,instantclient,/opt/lampp/lib/instantclient' '--with-mcrypt=/opt/lampp' '--with-mhash=/opt/lampp' '--enable-sockets' '--enable-mbstring=all' '--with-curl=/opt/lampp' '--enable-mbregex' '--enable-zend-multibyte' '--enable-exif' '--with-bz2=/opt/lampp' '--with-sqlite=shared,/opt/lampp' '--with-sqlite3=/opt/lampp' '--with-libxml-dir=/opt/lampp' '--enable-soap' '--enable-pcntl' '--with-mysqli=mysqlnd' '--with-mime-magic' '--with-iconv' '--enable-dio' '--with-pdo-mysql=mysqlnd' '--with-pdo-sqlite' '--with-pdo-oci=shared,instantclient,/opt/lampp/lib/instantclient,10.2.0.4' '--enable-intl' '--with-icu-dir=/opt/lampp' '--enable-fileinfo' '--enable-phar'

* Build PHP
make

* Copy the pdo_oci.so file to the right place. DO NOT RUN make install.
sudo cp modules/pdo_oci.so /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626

* Enable the extension
Add the line 'extension=pdo_oci.so' to /opt/lampp/etc/php.ini

* Restart Apache
/opt/lampp/lampp restartapache

Keywords: pdo_oci, xampp, oracle, linux, pdo, oci, lampp, symfony 1.4.0, doctrine, php 5.3.1

Re: Building pdo_oci.so for XAMPP Linux 1.7.3a

PostPosted: 31. January 2011 18:18
by EFil
Hi,

You tutorial seems very detailed, still, a little dificult for non linux experts.
Is there any way to do this withou (at least) having to recompile stuff?

I just want to access an oracle database using pdo (required for prado framework)

Thanks
EFil