Definitive FreeTDS installation instructions for EA3

cPanelDavidL

Member
Staff member
Nov 12, 2007
17
1
51
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.
 
Last edited by a moderator:

Zion Ahead

Well-Known Member
Nov 10, 2006
347
0
166
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?
 
Last edited:

usercpanel

Member
Aug 30, 2007
15
0
51
Definitive FreeTDS installation instuctions and install MSSQL module

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

configure: error: Could not find /usr/local/freetds/lib64/libsybdb.a|so
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

:)
 

ponchorage

Registered
Jul 20, 2011
2
0
51
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.
 
Last edited:

minosjl

Well-Known Member
Jun 4, 2011
168
0
66
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.
 

ringo380

Registered
Nov 1, 2011
1
0
51
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.
 

efeito

Well-Known Member
PartnerNOC
Jul 24, 2003
141
0
166
.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?
 

dhruvpandit

Member
Sep 4, 2011
12
0
51
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
 

fcbinfo

Well-Known Member
Dec 10, 2006
111
3
168
cPanel Access Level
Root Administrator
When i try to use that with the latest version, dont work, then i install with the 0.82 version, and works good.

ibiblio.org/pub/Linux/ALPHA/freetds/old/0.82/freetds-0.82.tar.gz

Dont know why! But now, i have it working. =)
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
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!
 

CeRBeR

Registered
Jan 25, 2011
2
0
51
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
 

Hiremind

Registered
Apr 13, 2013
1
0
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.
 

routerrat

Registered
Apr 14, 2013
2
0
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' !!
[email protected][/home/freetds-0.82]#
 

routerrat

Registered
Apr 14, 2013
2
0
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
========



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' !!
[email protected][/home/freetds-0.82]#