The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Definitive FreeTDS installation instructions

Discussion in 'General Discussion' started by cPanelDavidL, Aug 2, 2008.

  1. cPanelDavidL

    cPanelDavidL Member
    Staff Member

    Joined:
    Nov 12, 2007
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    1) Download FreeTDS
    Code:
    wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
    2) Extract

    Code:
    tar zfvx freetds-stable.tgz
    3) Configure $ Make

    Code:
    cd freetds-*;
    ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld; make ; make install
    4) Add the compile flag for freetds to /var/cpanel/easy/apache/rawopts/all_php5

    In this version, PHP 5 is the focus hence that specific file.

    Add the following:

    Code:
    echo "--with-mssql=/usr/local/freetds" >> /var/cpanel/easy/apache/rawopts/all_php5
    *If you are using other Builds of Apache or PHP you may refer to the following for the correct file to edit instead of /var/cpanel/easy/apache/rawopts/all_php5 such as the case here.

    * Apache 1.3.x - /var/cpanel/easy/apache/rawopts/Apache1
    * Apache 2.0.x - /var/cpanel/easy/apache/rawopts/Apache2
    * Apache 2.2.x - /var/cpanel/easy/apache/rawopts/Apache2_2
    * All PHP 4.x versions - /var/cpanel/easy/apache/rawopts/all_php4
    * All PHP 5.x versions - /var/cpanel/easy/apache/rawopts/all_php5
    * Mod_suPHP - /var/cpanel/easy/apache/rawopts/all_suphp
    * Specific PHP Version - /var/cpanel/easy/apache/rawopts/PHP-X.X.X


    5) Touch the following files as these are what are checked for by PHP. The following error will result if they are not in place.

    configure: error: Directory /usr/local/freetds is not a FreeTDS installation directory

    Here are the files to create for PHP's conditional check:
    Code:
    touch /usr/local/freetds/lib/libtds.a
    touch /usr/local/freetds/include/tds.hp
    6) Now run Easy Apache and make sure that Mysql, Mysql of the system, amd Mysqli are all selected.

    7) Simply build.

    Code:
    /scripts/easyapache
    
    I want to restate that at this time we do not support FreeTDS but we know many of you implement it's use. The main issue is with PHP not recognizing the build changes that FreeTDS developers have put in place. PHP's onditionals are still looking for 2 files that no longer exist in recent builds of FreeTDS hence PHP will always fail unless the files instructed to be `touched` here are in place.
     
    #1 cPanelDavidL, Aug 2, 2008
    Last edited by a moderator: May 3, 2012
  2. Juanra

    Juanra Well-Known Member

    Joined:
    Sep 22, 2001
    Messages:
    777
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Spain
    Typo

    In step 5 it should say

    touch /usr/local/freetds/include/tds.h
     
  3. Zion Ahead

    Zion Ahead Well-Known Member

    Joined:
    Nov 10, 2006
    Messages:
    347
    Likes Received:
    0
    Trophy Points:
    16
    There is no files nor directories inside
    /var/cpanel/easy/apache/rawopts

    Please explain what to do.

    I'm using PHP 5 / Apache 2.2

    Do I simply do a "touch" on those to create the files?

    Also, how can I determine freetds was properly compiled?
     
    #3 Zion Ahead, Mar 20, 2009
    Last edited: Mar 20, 2009
  4. HorburySchool

    HorburySchool Active Member

    Joined:
    Dec 14, 2007
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    Yes, touch the file in question, then edit it to populate it's content.
     
  5. InterServed

    InterServed Well-Known Member

    Joined:
    Jul 10, 2007
    Messages:
    255
    Likes Received:
    2
    Trophy Points:
    18
    cPanel Access Level:
    DataCenter Provider
    Doesn't seem to be working for x64 systems , wish the post owner would make instructions for x64 aswell :) thanks !
     
  6. usercpanel

    usercpanel Member

    Joined:
    Aug 30, 2007
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Definitive FreeTDS installation instuctions and install MSSQL module

    - If running a 64bit OS and get an error about

    you'll need to link a directory.

    In this example it was an easy fix.

    #cd /usr/local/freetds/
    #ln -s /usr/local/freetds/lib lib64
    #ll /usr/local/freetds/lib64/libsybdb.a
    #ll /usr/local/freetds/lib64/libsybdb.so
    #/scripts/easyapache

    :)
     
  7. ponchorage

    ponchorage Registered

    Joined:
    Jul 20, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I'm on PHP 5.3.5 on WHM 11.30.1 (build 4) CENTOS 5.6 x86_64 standard. I need to use PDO so I've also added

    --with-pdo-dblib=/usr/local/freetds

    No matter what I do, I keep getting the configure error:

    configure: error: Directory /usr/local/freetds is not a FreeTDS installation directory

    I've touched the indicated files and symlinked the lib folder but it simply isn't working. Has something changed recently to cause this to stop working? Are there additional files that PHP is looking for now? Please help, I'm tearing my hair out!

    I was able to get php to compile with just the line referencing mssql in the all_php5. It was after I added the line for pdo-dblib that I get the configure error. Seems like there may be some other files that this option is expecting to be in place. I see reference to include/sybdb.h in the config.m4 file of pdo_dblib but that that file does exist where expected as well as libsybdb.a being in the lib folder.
     
    #7 ponchorage, Jul 20, 2011
    Last edited: Jul 20, 2011
  8. minosjl

    minosjl Well-Known Member

    Joined:
    Jun 4, 2011
    Messages:
    168
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    cPanel Access Level:
    Root Administrator
    In order to enable PHP MSSQL Extension, There are few modules need to be installed before you enable MSSQL Extension for PHP on server.

    a) Txt2man
    b) unixODBC
    c) freeTDS
    d) PHP mssql.so

    Please check on your server have these modules installed on the server.
     
  9. gemisu

    gemisu Member

    Joined:
    Oct 14, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Venezuela
    cPanel Access Level:
    Root Administrator
  10. ringo380

    ringo380 Registered

    Joined:
    Nov 1, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Houston, Texas, United States
    cPanel Access Level:
    DataCenter Provider
    I just wanted to update this due to the brilliance of a colleague at our office here. We had a customer come in needing Freetds to be installed - while we weren't familiar with it, we followed these instructions but still ran into problems on the EasyApache compile. There was a simple solution fortunately, and in fact I'll simply copy and paste the chat conversation.

    Jason *****: what was happening was that two header files were defining LPBYTE
    Jason *****: you can't retype a variable like that
    Jason *****: so it errors out
    Jason *****: I commented out the LPBYTE in the sqlfront.h since its already defined by PHP
    Ryan *****: so essentially it's become a cpanel-compatible version of freetds? could probably post that in the forum
    Jason *****: prolly
    Jason *****: but my philosphy has always been if you can't puzzle it out from the object dump you shouldn't be running it

    So I figured I'd pass this info along in the event that it may help anyone out.
     
  11. efeito

    efeito Well-Known Member
    PartnerNOC

    Joined:
    Jul 24, 2003
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    .pt
    Hi there,

    i have freetds installed and working, but i cannot connect to the server because of TDS Version. I used the instructions provided on the inital post. Installed this on one server, and one vps. On server the TDS version is 8, and on the vps the TDS version is 5. But, both servers are equal configs.

    How can i update the TDS Version to 8?
     
  12. dhruvpandit

    dhruvpandit Member

    Joined:
    Sep 4, 2011
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    i have followed same as on 1st post, but still giving error :

    Warning: odbc_connect() [function.odbc-connect]: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /home/frendzho/public_html/xyz.co.cc/mssql.php on line 5

    Warning: odbc_exec() expects parameter 1 to be resource, boolean given in /home/frendzho/public_html/xyz.co.cc/mssql.php on line 10
    Error in SQL

    i have centOS
     
  13. fcbinfo

    fcbinfo Well-Known Member

    Joined:
    Dec 10, 2006
    Messages:
    120
    Likes Received:
    2
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
  14. CeRBeR

    CeRBeR Registered

    Joined:
    Jan 25, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
  15. efeito

    efeito Well-Known Member
    PartnerNOC

    Joined:
    Jul 24, 2003
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    .pt
    What is your Apache and PHP version? Are you using suphp?
     
  16. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    If the file does not exist, you can create it:

    Code:
    echo "--with-mssql=/usr/local/freetds" >> /var/cpanel/easy/apache/rawopts/all_php5
    The file will not exist by default. It's a custom file that you create when you want to add components that don't already exist. I've revised the existing guide to put my command instead, since it will create the file if it doesn't exist. If the file does exist, my command will add that entry to the bottom of the file without overwriting any already existing line(s).

    Thanks!
     
  17. CeRBeR

    CeRBeR Registered

    Joined:
    Jan 25, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Efeito & cPanelTristan thank you for quick reply i make cpaneltristan says

    I try now connect to mssql database

    How can i activate Freebsd component on my cpanel or whm
     
  18. Hiremind

    Hiremind Registered

    Joined:
    Apr 13, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    1. I have built a new PHP/MySQL/HTML website for a client, which is running on a shared-hosting LAMP server at GoDaddy.com
    2. The client has two other older ASP websites running on Windows servers – one of these is also hosted at GoDaddy.com (shared-hosting), the other is on a company internal dedicated server.
    3. When a visitor to my new site logs in, I need to access MSSQL databases managed by the other two sites, in order to determine if the visitor is an existing client of the company.
    4. I am not very knowledgeable about Linux/Apache, which leads to my FIRST QUESTION: Would I be correct in assuming that I need to install FreeTDS and ODBC on the GoDaddy LAMP server?
    5. So far, I have downloaded and unpacked FreeTDS onto my PC. I found your “Definitive FreeTDS installation instructions” at:
    http://forums.cpanel.net/f5/definitive-freetds-installation-instructions-88561-p2.html
    but at this point my lack of knowledge leaves me with several questions:
    • Am I correct in assuming that steps 3) and forward of your procedure are to be performed on the LAMP server? (I tried reading the FreeTDS User Guide, but found it to be hopelessly confusing)
    • If my assumption is correct, which of the FreeTDS multitude of files actually need to be uploaded to the server, and to which directory?
    • In the shared-hosting environment, I only have access to my account webroot, and not to paths such as:
    /var/cpanel/easy/apache/rawopts/all_php5 and /usr/local/freetds
    Does this mean that I simply cannot install FreeTDS/ODBC in a shared-hosting environment?
    • If the installation is possible, how do I interpret the above paths?
    Thanks for any guidance you can give me.
     
  19. routerrat

    routerrat Registered

    Joined:
    Apr 14, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    I've linked the 64 library why would I get this error below? Thanks.

    checking for mcrypt support... no
    checking for MSSQL support via FreeTDS... yes
    configure: error: Could not find /usr/local/freetds/lib64/libsybdb.a|so
    !! './configure --disable-fileinfo --disable-pdo --enable-bcmath --enable-calendar --enable-ftp --enable-libxml --enable-magic-quotes --enable-sockets --prefix=/usr/local --with-apxs2=/usr/local/apache/bin/apxs --with-curl=/opt/curlssl/ --with-imap=/opt/php_with_imap_client/ --with-imap-ssl=/usr --with-kerberos --with-libdir=lib64 --with-libxml-dir=/opt/xml2/ --with-mssql=/usr/local/freetds --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-openssl=/usr --with-openssl-dir=/usr --with-pcre-regex=/opt/pcre --with-pic --with-zlib --with-zlib-dir=/usr' failed with exit code '256' !!
    !! Restoring original working apache !!
    !! Executing '/scripts/initsslhttpd' !!
    !! Restarting 'httpd' ... !!
    !! 'httpd' restart complete. !!
    Building global cache for cpanel...Done
    !! Executing '/scripts/initfpsuexec' !!
    !! Executing '/scripts/initsslhttpd' !!
    !! Executing '/scripts/update_apachectl' !!
    !! Executing '/scripts/enablefileprotect' !!
    Compiling report...
    Sending report. As some of the attached files may be quite large, this could take a few minutes. Thanks for your patience.
    !! If you want to create a support ticket with cPanel regarding this please reference 'BuildAP Report Id': '10503659' !!
    Report processed.
    !! Feel free to submit a support ticket at https://tickets.cpanel.net/submit/index.cgi?reqtype=tickets !!
    !! Verbose logfile is at '/usr/local/cpanel/logs/easy/apache/build.1365939705' !!
    root@myserver[/home/freetds-0.82]#
     
  20. routerrat

    routerrat Registered

    Joined:
    Apr 14, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    Hey seems like I've only run the second line of 'Usercpanel's post but you need to do the all and check with ls -l if they are actually linked.

    All of this below for x64 servers.
    =======
    you'll need to link a directory.

    In this example it was an easy fix.

    #cd /usr/local/freetds/
    #ln -s /usr/local/freetds/lib lib64
    #ll /usr/local/freetds/lib64/libsybdb.a
    #ll /usr/local/freetds/lib64/libsybdb.so
    #/scripts/easyapache
    ========



     

Share This Page