If you need generic instructions on how to compile a PHP5 module on Debian, please follow this link.
For pdo_oci you need to depart a bit from the canonical way. Follow these instructions in order to get a nicely built and installable debian package for it. Note that you need to have an Oracle client properly installed and configured for this module to be useful.
Below is a simple cake recipe for achieving that. Please modify according to your needs.
mkdir -p ~/src/php5
apt-get source php5
pecl package package2.xml
These steps will have generated a PDO_OCI-1.0.1.tgz archive. Now you want to make this package debian-ready. Begin by issuing the following command (found in the package dh-make-php):
dh-make-pecl --only 5 PDO_OCI-1.0.1.tgz
Now comes the magic. Enter the newly created directory php-pdo-oci-1.0.1 and edit the file debian/rules:
Find the line that declares the constant PECL_PKG_NAME and change it from
Now look for the block
There, right after the line that says
insert these lines:
sed -e 's/prefix\/include\/php\/ext/prefix\/include\/php5\/ext/' configure > /tmp/pdo_oci-configure; \
cp /tmp/pdo_oci-configure ./configure; \
Save the file and proceed with package creation:
dpkg-buildpackage -rfakeroot -us -uc
If no errors are reported, you will have just created a debian package into .. for pdo_oci ready to be installed by dpkg.
UPDATE: If you are having problems with your Oracle libs and/or includes not being found, try installing the instantclient packages (alien them from the RPMs found on Oracle’s downloads website). Here I am using the 11.2 x86_64 client. If yours differ, please adjust the paths accordingly.
First, make a symbolic link:
# cd /usr/lib/oracle/11.2/client64
# ln -s /usr/include/oracle/11.2/client64 ./include
Then, set some environment variables:
And you should be good to go!