Compiling PHP w/ support for Oracle, MySql and MSSql

Compiling PHP on linux w/ support for Oracle, MySql and MSSql turned out to be quite a chore. The Mysql part was easy, I guess due to the long history of using php with mysql.

In order to get support for MSSql I had to download and compile a package called FreeTDS which provides support for MSSql and Sybase. But after compiling and installing FreeTDS, I got an error:

configure: error: Directory /PATH/TO/freetds-0.82 is not a FreeTDS installation directory

Turns out php is looking for files that are no longer part of FreeTDS. Thanks to google I found the solution.

PHP tests for a FreeTDS installation by looking for files that FreeTDS no longer installs. To assure PHP that FreeTDS is installed, create two files where FreeTDS was installed e.g.:

$ touch /usr/local/freetds-0.82/include/tds.h
$ touch /usr/local/freetds-0.82/lib/libtds.a

Now for Oracle. That was a bear, too. I found much conflicting information on the internet but mainly it seemed that I needed to use a couple of flags to the php configure script:

–with-oracle=/PATH/TO/ORACLE and –with-oci8=/PATH/TO/ORACLE

However, both of those were wrong. The php configure script ended with apparent success but warning that I had used to unknown options. It turned out that I needed


I found that by running the configure script with the –help option. Of course I had to install the oracle instantclient and sdk before any oracle support would work. I also installed sqlplus just to be on the safe side. Those packages are free to download if you create an oracle login.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: