How To: Install mssql extension for php on unix

woh! okie.. this installation is gng to be long a tough.. took me a few days of google crawling and testing before i finally get it to work.

okie, why will u need to install mssql extension on php? possibly becos u need to connect to a ms sql server of ur vendor or something like that. for integration i hope. cos unix works best w php and mysql, ie, installation, it is almost already thr. correct me if i m wrong.

so wad you need?
if your server is jus fresh out of the box or say u had installed whm/cpanel there will be quite a far bit of stuff u will need.

1. Txt2man
2. unixODBC
3. freeTDS
4. PHP mssql.so

if this point if you are wondering if i m using any rpm for installation?
sorry,i m not, cos my server centos installed w whm/cpanel seems to be poorly equipped or configured for rpm installation, too many dependencies required. so jus download all the binary and upload them onto ur server.

Setup 1: Install unixODBC package

Install unixODBC first. Download the software in your home directory or anywhere you like and uncompress and untar the software.

You can do this by using following command

# tar -xvzf unixODBC-2.2.12.tar.gz

Once it is done, go to the unixODBCxxxx dir and run the configure command.

# ./configure -prefix=/usr/local -enable-gui=no

Note: If you dont use enable-gui option and dont have Qt package, you will get the error. So make sure you use it if no Qt is installed.

After configure is successfully completed, run the make and then make install commands.

# make

Install it

# make install

Step 1.1: Installing Txt2man
this step is optional if your server already have txt2man installed.
txt2man is required by freeTDS to man it documentation, i do find this portion pretty useless though.
else jus download the package, and run the make

# make

Install it

# make install

Step 2: Install freeTDS package

Download the freeTDS package and untar and uncompress it.

# tar -xvzf freetds-stable.tgz

Run the configure.

# ./configure -with-tdsver=8.0 -with-unixODBC=/usr/local

Run the make

# make

Install it

# make install

Step 3: Configuration freeTDS
Start configuration with freeTDS. Look for the freetds.conf file and add the entry for the MS SQL server.

[MSHOSTNAME]
host = MSHOSTNAME
port = 1433
tds version = 8.0

Sql server standard port is the 1433. The tds version for MS SQL server 2000 is 8. You can try 8.0 with new version as well.
Important: the host need to be the same as the declaration. ie
if you have [mssql.hostname.com], ur host will be = mssql.hostname.com

Step 4: Configuration – unixODBC

The unixODBC need two main configuration files called odbcinst.ini and odbc.ini. These files should be in the /etc/ dir.

I. The first file odbcinst.ini contain the definition of ODBC driver.

[TDS]
Description = FreeTDS driver
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/local/lib/libtdsodbc.so
Trace = Yes
TraceFile = /tmp/freetds.log
FileUsage = 1

Note: Before making above entries, make sure libtdsodbc.so exists in the /usr/local/lib dir.
In the above configuration, we have define TDS as driver.

II. The second file is odbc.ini. This file has information about your MS SQL database.

[MSHOSTNAME]
Driver = TDS
Description = MS SQL Test
Trace = Yes
TraceFile = /tmp/mstest.log
Servername = 192.168.1.100
Database = testdb
Port = 1433

You can notice above that the freeTDS driver is the name defined in odbcinst.ini while servername is the one defined in freetds.conf.

Step 5: Test MS SQL connectivity from Linux box
Check if you can connect to MS SQL database using unixODBC tool called isql.

# isql -v mstest satest satest
+—————————————+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+—————————————+
SQL> select * from “sysObjects”;

If you see the results, you are connected.

Step 6: Getting your mssql.so file
Update: I came back to follow this to create an .so file and realise, mmm, this instruction wasn’t too clear. So here it goes. From PHP.net Download page, download the source code, then if you unzip, you will find a folder “ext” and “mssql” in the “ext” folder. tat’s the folder i m referring to, ‘cd’ to this folder and then run phpize as below mentioned.

Add: for the benefits of those who just need the .so file, you can download the mssql.so from here. however, i don’t assure, compatibility with you php version. is built with php 5.2.10 binaries.

php.net is not distrubuting the binary version of php package for *nix server, so you will have to create the .so extension file yourself. download the source file for php and upload the folder /ext/mssql/ into your server
then

# cd /uploaded_path/mssql/
# phpize
# ./configure
# make
# make install

this commands will automatically create a copy of mssql.so in the installed extension folder.
you can check your extension folder from

<?php
phpinfo();
?>

Step 7: Enabling the extension

# echo “extension=mssql.so” > /usr/local/lib/php.ini

or you can use a texteditor and add that value manually into php.ini

Step 8: Restarting Apache Server!
dependin on version installed and location

# /etc/init.d/httpd restart

and you are done!
do drop me an email should you face any problem at any step!
i know the pain in gettin this extension installed on unix. and considering rpm fails to work in the first place.
i will say, this is the best way to get it installed, cos u have full control over it. and didn’t fail me, of cos, after hell lots of googling around.

Source:
dpacool.com
unixodbc.org
Scott’s Blog
PHP PECL

67 Comments »

  1. didats Said,

    May 19, 2008 @ 3:04 am

    you are saving my life…

    Thank you very much for your documentation…!

  2. How to get it done » Blog Archive » Mac: Connecting to msSQL Server on Mac Said,

    May 28, 2008 @ 9:19 pm

    [...] Entropy.ch the following instruction is for you, else, you may try my earlier post on installing msSQL extension for php in *nix/Centos Server, largely used by [...]

  3. ialexs Said,

    June 16, 2008 @ 2:25 am

    thanks… at least i’m heading for the right direction…

    trying to work with yum/rpm first before getting the tar ball

  4. ialexs Said,

    June 16, 2008 @ 8:44 pm

    done. lucky me, my yum/rpm is all okay

    (search the freetds for your CentOS)
    # yum search freetds

    you’ll find freetds*.rpm freetds-devel*.rpm freetds-doc*.rpm

    (install with yum)
    # yum install freetds-xxx

    (or download the rpm with yumdownloader)
    # yumdownloader freetds-xxx

    the rest is the same with the above article

    :)

  5. admin Said,

    June 16, 2008 @ 8:47 pm

    ialexs! that great to hear. =)

  6. ialexs Said,

    June 16, 2008 @ 9:47 pm

    also notes, if it’s on a 64b box (in this case still with Centos),
    the freetds installing the lib in /usr/lib64

    be sure when do a “configure” in the php source directory to define the “–with-lib” option

  7. AlexM Said,

    August 15, 2008 @ 10:25 pm

    Your blog is interesting!

    Keep up the good work!

  8. Evan Said,

    August 26, 2008 @ 9:59 pm

    I cannot get passed step 4. For some reason, I cannot find the odbc ini files, both odbc.ini and ocbcinst.ini are missing from the /etc folder. I do have the libtdsodbc.so file though. How do I find the odbc ini files?

  9. Steven Said,

    August 27, 2008 @ 1:13 am

    Hi Evan, you got the first step right without errors? cos the installation will create those 2 files.

  10. Evan Said,

    August 27, 2008 @ 5:35 am

    Hi Steven,

    yeah the first 3 steps completed fine with no errors. I downloaded and installed everything from the /root folder as root user. However, I forgot where unixODBC was installed after I ran the make install. Is there a way to manually copy the ini files from somewhere?

  11. Steven Said,

    August 27, 2008 @ 5:53 am

    Evan, you need to find the directory where you installed, cause ODBC is configured to read from those path. u can try this, “vi unix.ini” and then insert the above content, and same for odbcinst.ini
    not too sure if this will work tho. let me knw! =)

  12. Evan Said,

    August 27, 2008 @ 6:26 am

    understood. I created the ini files and cloned the content above. Now on step 5, I am ready to test isql. My firewall admin has not opened port 1433 yet but I have all the settings correct for the ini file. So naturally when doing the isql test connect it will say data source name not found, but it also says no default driver specified.

    Will both these errors go away when the port is open or do I still need to do something about the default driver?

  13. Evan Said,

    August 27, 2008 @ 6:38 am

    whoops, guess what, I found the odbc.ini and odbcinst.ini files in the /usr/local/etc folder. That’s where it was installed by the unixODBC make install. I edited these and removed the ones I made in the /etc folder in the root.

  14. Steven Said,

    August 27, 2008 @ 6:50 am

    ah ha!!! u get to connect w isql? i think u may need to open the port first.

  15. Evan Said,

    August 27, 2008 @ 7:39 am

    lol. Of course I may be getting too preemptive here, but I don’t suppose there is an easier way to get step 6 done, I’m having trouble finding the binary mssql.so download. I found an RPM on rpmfind.net but I’m not sure if that’s the right one. Can’t you tell I’m a newbie? :)

  16. Steven Said,

    August 27, 2008 @ 7:45 am

    no worries, that actually the easiest after ur first try, go to http://www.php.net/downloads.php to download the complete source for your version, the same major version shld works too actually.. then mssql.so can be found inside.

  17. Evan Said,

    August 27, 2008 @ 8:26 am

    ack! ok I got the source, tarred and browsed to /root/php-5.2.6/ext/mssql

    Did the phpize and then ./configure.

    After starting ./configure it halts and says it cannot find freeTDS in known installation directories. Is there a setting I’m missing to maybe change the path to where FreeTDS is? (/usr/local/lib)

  18. Evan Said,

    August 27, 2008 @ 1:22 pm

    I added this to the configure line:

    ./configure –with-mssql=/usr/local

    Now it errors out with /usr/local not being a freetds installation directory.

  19. Steven Said,

    August 27, 2008 @ 7:58 pm

    did u run freetds configure w the following line?

    # ./configure -with-tdsver=8.0 -with-unixODBC=/usr/local

    you seems to be facing quite a bit of wrong installation directory, on unixodbc too.

  20. Steven Said,

    August 27, 2008 @ 7:58 pm

    mmm, okie i wun say wrong, but non-default or standard folders.

  21. Evan Said,

    August 28, 2008 @ 9:01 pm

    Yeah I did exactly that on the ./configure line. Perhaps fate doesn’t want me to succeed with this. If I can just get the mssql.so file copied to the directory and add extension=mssql.so to the php.ini file, is that all I really need?

  22. Steven Said,

    August 28, 2008 @ 9:49 pm

    evan, yes! get the original php source to produce the mssql.so instead of getting the file itself, better to be done this way.

  23. Evan Said,

    August 28, 2008 @ 9:52 pm

    That’s what I’m trying to do but I can’t get it to work. That’s where I run into the error that #$%# freetds install directory is not valid.

  24. Evan Said,

    August 30, 2008 @ 6:25 pm

    ok I made some progress, the 0.82 version of freetds doesn’t seem to work here so I went back to 0.63, and I was able to make the mssql.so file and it copied to the php extensions directory. Upon adding it to the php.ini file with extension=mssql.so it seemed to have no effect. The phpinfo() does not show MSSQL support and the test page still shows mssql_connect as an undefined function.

  25. Steven Said,

    August 30, 2008 @ 7:53 pm

    ah! u restarted apache?

  26. Evan Said,

    August 30, 2008 @ 10:58 pm

    yes sir! did both versions:

    service httpd restart
    /etc/inid.d/httpd restart

    apache restarted but php did not add the mssql support…

  27. Evan Said,

    August 30, 2008 @ 11:43 pm

    crap. ok I got past that error and now php recognizes mssql support. but I can’t connect to my mssql server. I have to access it by it’s ip address and I already have port 1433 open.

  28. Steven Said,

    September 3, 2008 @ 9:24 pm

    Hey Evan, sorry i was away, so how is it now?
    successfully installed?

  29. Evan Said,

    September 7, 2008 @ 5:45 pm

    Hi Steven, no problem, I was away as well and just returned. I was able to get everything working perfectly! The only thing that was left standing in the way was a minor glitch that prevented connection to port 1433 but I got it resolved. Thanks again for all your help!

    By the way, I hope people will know that the latest build of FreeTDS (0.82) does not work with these instructions as it does not contain the tds.h file anymore. I had to download the 0.63 version to get it working.

  30. Steven Said,

    September 7, 2008 @ 8:07 pm

    Alright man!
    Yep, thanks for the update!

  31. Brian Said,

    September 18, 2008 @ 10:27 pm

    Steven, I ran across your info and it’s been a godsend helping me to do what’s necessary to connect to MSSQL from my SuSE Linux 11.0 system. Your instructions work fine so long as I use the package manager in SuSE to install things. But then, just like Evan, the ./configure command for making mssql.so halts and says “Cannot find FreeTDS in known installation directories”.

    Linux rpm’s put php, freetds and others in non-standard locations. For example, UnixODBC config files are in /etc/unixODBC, and lib files are in /usr/lib64/ and /usr/lib64/unixODBC/. Freetds executables are in /usr/bin/, config files are in /etc/ and lib files are in /usr/lib64.

    Maybe I can edit the php configure script to look for freetds elsewhere.

    I peeked into the script and it appears to be looking for a file called tds.h either in ‘/usr/local/include/’ or
    /usr/include/’. I found out that freetds-0.82 no longer writes a file called ‘tds.h’.

    One solution I found is to create two files where FreeTDS was installed e.g.:
    > $ touch /usr/include/tds.h
    > $ touch /usr/lib/libtds.a

    I think for me that would mean ‘/usr/lib64/’.

    Another solution I found is to edit the configure script (see http://bugs.php.net/bug.php?id=44991)

    if test “$PHP_MSSQL” = “yes”; then
    for i in /usr/local /usr; do
    - if test -f $i/include/sybdb.h; then
    + if test -f $i/include/tds.h; then
    FREETDS_INSTALLATION_DIR=$i
    FREETDS_INCLUDE_DIR=$i/include
    break
    - elif test -f $i/include/freetds/sybdb.h; then
    + elif test -f $i/include/freetds/tds.h; then
    FREETDS_INSTALLATION_DIR=$i
    FREETDS_INCLUDE_DIR=$i/include/freetds
    break
    @@ -27,10 +27,10 @@

    elif test “$PHP_MSSQL” != “no”; then

    - if test -f $PHP_MSSQL/include/sybdb.h; then
    + if test -f $PHP_MSSQL/include/tds.h; then
    FREETDS_INSTALLATION_DIR=$PHP_MSSQL
    FREETDS_INCLUDE_DIR=$PHP_MSSQL/include
    - elif test -f $PHP_MSSQL/include/freetds/sybdb.h; then
    + elif test -f $PHP_MSSQL/include/freetds/tds.h; then
    FREETDS_INSTALLATION_DIR=$PHP_MSSQL
    FREETDS_INCLUDE_DIR=$PHP_MSSQL/include/freetds
    else
    @@ -38,8 +38,8 @@
    fi
    fi

    - if test ! -r “$FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.a” &&
    test ! -r “$FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.so”; then
    - AC_MSG_ERROR(Could not find
    $FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libsybdb.[a|so])
    + if test ! -r “$FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libtds.a” &&
    test ! -r “$FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libtds.so”; then
    + AC_MSG_ERROR(Could not find
    $FREETDS_INSTALLATION_DIR/$PHP_LIBDIR/libtds.[a|so])
    fi

    PHP_ADD_INCLUDE($FREETDS_INCLUDE_DIR)

    This link was last dated Jun 13, 2008.

    I don’t think this completes the solution for me unless I also change the directory in which the script is looking. And change the file it’s looking for: my installation of freetds doesn’t have ‘ibsybdb.so’. It has ‘ibsybdb.so.5′.

    This is a long comment. It may prove useful to others. I’m going to mess around with these ideas and see if they help me.

  32. Steven Said,

    September 19, 2008 @ 2:39 am

    Hey Brain, definitely useful, i think i am gng to rewrite this documentation after i try doing a new installation on another server w the latest available versions.
    of cos, when i have got the time.

    yea, installing mssql in linux is one pain in the ass, it took me 2 weeks before i finally concluded on the above. most of the rpm because of versions issues dun really seems to work well with each other, unless u got the specific version that comes together.

  33. Brian Said,

    September 19, 2008 @ 8:01 am

    Well, I made a few little changes to the configure script so it not barf when it came to locating freetds. I altered the location it was looking in and the file it was looking for and so the ‘./configure’ command was rewarded with “config.status: creating config.h”.

    Hoping for the best, I proceeded to the ‘make’ command. It bombed with a laundry list of errors. The first ones were

    error: sqlfront.h: No such file or directory
    error: sqldb.h: No such file or directory
    error: expected specifier-qualifier-list before ‘LOGINREC’

    … and 320 more. I’ll start scouring the net for what to do now. Damn!

  34. Brian Said,

    September 19, 2008 @ 8:58 am

    Steven, I discovered I had to install the ‘freetds-devel’ and ‘python-devel’ (2.5.x) rpm’s to work out those dependencies needed by the configure script. The ‘make’ and ‘make install’ commands then worked fine and the ‘mssql.so’ extension was automatically created in ‘/usr/lib64/php5/extensions’ (where SuSE wants ‘em).

    After that I copied and pasted the [MSSQL] section from another ‘php.ini’ (I had on my Mac, where mssql connections already worked) and I created ‘mssql.ini’ in ‘/etc/php5/conf.d/’ (where SuSE wants them) so that the ‘mssql.so’ extension would load. Finally I restarted Apache and my goal was reached.

    Thanks a million for putting your solution on the web! It took a lot of searching before I found it. You might be the only person who’s published a solution.

  35. Steven Said,

    September 19, 2008 @ 9:23 am

    Brian, you are most welcome! btw, what OS and version r u on?

  36. Brian Said,

    September 19, 2008 @ 12:44 pm

    Principal software and versions: OpenSuSE 11.0 x86_64, KDE 4, PHP 5.2.6, Apache 2.2.8, PostgreSQL 8.3.3, running on an 8-core Intel MacPro in a dual-boot configuration

  37. Steven Said,

    September 19, 2008 @ 7:32 pm

    Ah, why didn’t u try Entropy PHP?!
    http://www.entropy.ch/software/macosx/php/?phpinfo-version=5.2.5-6

  38. OFF TOPIC! » SQL Server support on PHP (php-mssql) Said,

    September 30, 2008 @ 11:59 am

    [...] to Brian for the [...]

  39. Justin A Said,

    February 12, 2009 @ 9:04 am

    Hi. I tried to install FreeTDS on a system running a 64bit version of opensuse. I couldn’t get it to work.
    I run
    # ./configure -with-tdsver=8.0 -with-unixODBC=/usr/local

    and
    then make.
    After that I run make check to see if it worked.
    it ends up saying that I failed 10 of 13 tests in the make check.

    I was wondering if you ever ran into a problem like this ?

  40. Steven Said,

    February 14, 2009 @ 11:31 am

    hi Justin, you may want to check the versions? of your tds and unixodbc built.
    i know of installation test failure for newer version or either.

  41. R Said,

    February 17, 2009 @ 6:16 pm

    help!
    after on step 6 i got the following error:
    Cannot find config.m4.
    Make sure that you run ‘/usr/bin/phpize’ in the top level source directory of the module
    i’m very sure that i am in directoy ‘/usr/bin when executing “phpize” sorry i’m new in linux and i don’t know what that means…

  42. Endackady Said,

    May 23, 2009 @ 6:39 am

    eh. really like it :)

  43. José Carlos Said,

    July 19, 2009 @ 4:57 pm

    hi!!!

    I have tried this and lots of tutorials but I couldn’t obtain mssql.so

    Coul anybody please send me it to jcchavezs[a]uni.pe

    ITS TOOOOOOO URGENT PLEASE

    thanks a lot!!!!!

  44. fotos de chicas en ligero Said,

    July 19, 2009 @ 6:13 pm

    I should notify you about it.

  45. Steven Said,

    July 19, 2009 @ 7:25 pm

    Hi José Carlos,

    I have upload a copy of mssql.so here, you can download from, but will still recommend you follow the steps above to get your .so file. do hope it helps.

  46. uberweiss Said,

    March 4, 2010 @ 8:54 am

    i have followed this guide but get the following error when i run the command isql -v mstest satest satest which is under step 5.

    [IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
    [ISQL]ERROR: Could not SQLConnect

    can anybody help what this mean.?!?

  47. Steven Said,

    March 4, 2010 @ 9:30 am

    uberweiss, you may want to check your “/usr/local/lib/” folder if the “libtdsodbc.so” is there? and make sure in step 3 your names are same and correct.

  48. invisibled Said,

    March 4, 2010 @ 1:02 pm

    Hey There,

    I followed the tutorial and connected to the database in terminal no problems. But I can’t seem to get the mssql extension installed. It Doesn’t show up in phpinfo() and says call to undefinded function when i run mssql_connect()

    any suggestions? I’m using OS X snow leopard.

  49. Steven Said,

    March 4, 2010 @ 10:46 pm

    invisibled, you may want to check out http://lists.ibiblio.org/pipermail/freetds/2009q2/024684.html for snow leopard.

  50. uberweiss Said,

    March 5, 2010 @ 2:32 am

    Dear Steven.

    Thank you very much for your feedback.

    the “libtdsodbc.so” wasnt in “/usr/local/lib/” but in “/usr/lib/” so i have copied it to “/usr/local/lib/”.#

    i’ve checked the information entered in the /etc/freetds.conf and it looks correct.

    [a_name]

    host = 192.168.10.5
    port = 1433
    tds version = 8.0

    but i still get the same error.

  51. Steven Said,

    March 5, 2010 @ 8:53 am

    uberweiss, you may want to double check your freeTDS installation. the configuration for unixODBC will work correctly only if those files are installed in the correct directory, cause there is direct dependancy.

  52. uberweiss Said,

    March 9, 2010 @ 12:37 am

    I have double checked everyting. changed the conf. for unixODBC to point to /usr/lib/ all server info is correct but i still get.

    [IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
    [ISQL]ERROR: Could not SQLConnect

  53. Marcel Said,

    March 25, 2010 @ 6:28 am

    Hi there.

    Thanks a lot for such a nice tutorial on how to connect to MS SQL from Linux.

    I have a problem with my installation. I am following precisely the steps mentioned here and I am able to connect to my database with tsql without any problems.

    It fails when I try using the isql command using isql MYIP MYUSER MYPASS

    It just comes up with an error:
    [S1000][unixODBC][FreeTDS][SQL Server] Unable to connect to data source

    I am completely helpless because I have really checked a 1000 times that the information I set up in the configuration files are a 100% ok.

    Can somebody offer help please?

    Thanks a lot in advance.
    Marcel

  54. Adam Said,

    April 5, 2010 @ 1:28 pm

    I have the same issue as Marcel. Anyone know the solution?

  55. Steven Said,

    April 5, 2010 @ 2:15 pm

    hey adam, check your unixODBC installation and version to be 2.2.12
    do note this document applies specifically to this version of unixODBC only, apparently there is some conflicting issues between the various connectors in the later versions.
    i m not too sure if that is resolved already.

  56. Adam Said,

    April 6, 2010 @ 7:54 am

    I am running 2.2.11. Do you think this makes that much of a difference? This is really frustrating. I have tried every combo of config file fixes I have found on the net without much luck.

  57. Adam Said,

    April 6, 2010 @ 8:02 am

    Ok. I just figured it out. I didn’t have the user-DSN setup. You apparently need both.

  58. Steven Said,

    April 6, 2010 @ 8:34 am

    adam, great to hear you fix it, which part of the user-DSN are you referring to? so i can update the documentation

  59. Adam Said,

    April 6, 2010 @ 12:02 pm

    What I needed to do was put an entry for the DSN in the odbc.ini that is in the /etc/ folder as well as an entry in the file /home/username/.odbc.ini.

  60. renato batisteli pinto Said,

    April 7, 2010 @ 3:06 pm

    Hi
    Although new to linux I have a real problem with a MSSQL DB connection. I have, on one side, a server fedora-core8 and on the other hand, a Windows Server 2000. After much hesitation I decided to follow this tutorial but since installing the unixODBC I get the following error: configure: error: non acceptable C compiller found in $ PATH.
    I look for config.log but can not identify where the problem lies. Some good soul can help me?
    Sorry for the style I’m not fluent in English

  61. Brad Said,

    May 28, 2010 @ 3:59 pm

    Great tutorial! I used this in conjunction with one I found here:

    http://www.dotvoid.com/

    FYI I had to install php5-sybase to get php to recognize the mssql_* functions. In ubuntu 10.04 I just ran this:

    sudo apt-get install -y php5-sybase

    Also, I’m not sure if it really matters much, but I did add these empty text files to the freetds installation directory:

    touch /usr/local/include/tds.h
    touch /usr/local/lib/libtds.a

    By the way, if you don’t specify a directory, freetds installs by default in /usr/local/

    One last thing:

    When I installed the mssql.so file, I specified the freetds installation directory, like so:

    ./configure –with-mssql=/usr/local

  62. Steven Said,

    May 28, 2010 @ 9:10 pm

    Hi Brad, glad that it’s helpful and thank you for the updates! =)

  63. Phillip Said,

    June 13, 2010 @ 6:06 am

    Thank you very much…
    After 2x months I now have it fixed in OpenSUSE-Factory.
    Pity that the Novell / SUSE does not see this as a feature.
    Ubunto and Fedora has this by default…

  64. Ash Said,

    September 2, 2010 @ 11:50 am

    Hi Steven,
    This tutorial is very helpful. Though many comments have really confused me for a while. I am trying to connect to MS SQL through PHP on Ubuntu.
    The error says mssql.a|so is missing. I don’t know if its same .so file we are looking at. Can you please tell me how to downgrade and upgrade to later version of freeTDS. Thank you for ur help.

  65. Steven Said,

    September 2, 2010 @ 10:12 pm

    Hi Ash, great to hear that this tutorial have been helpful.

    Yep, seems like the .so file is missing. since freeTDS is a source code library you jus need to get the version you need and overwrite w config-make-install will do.

  66. Ash Said,

    September 3, 2010 @ 7:52 am

    Hi Steven,
    Sorry to bother again. I removed the php5 directory which i had before and installed php-5.2.14. I still could not find .so file in its ext/mssql/ directory but i did find one in usr/lib/php5/20060613+lfs/ but i don’t understand one thing. Do i need to copy it back to the ext/mssql/ folder or what should i do next. there is no configure file in ext/mssql to run the ./configure command.

    Also the phpinfo() page shows (none) in place of loaded configuration file. Does it mean that it cannot locate php.ini file? I am sure i did configure, make, make install and also make test .

    Please help.

    Thnks

  67. Steven Said,

    September 3, 2010 @ 10:51 am

    Hi Ash,

    You do have “Configuration File (php.ini) Path ” right? That should be the folder where your php.ini will be loaded from by default it “Loaded Configuration File” shows “(none)”.

    Find “PHP Extension” in your phpinfo(). if it shows “20060613+lfs”, it means the .so extension file is loaded in the right directory.

    Follow the steps in step 6 should let you create the .so file in the right directory.

    hope this helps! :)

RSS feed for comments on this post · TrackBack URI

Leave a Comment