Solved

How to connect Linux-PHP to MS-SQL Server?

Posted on 2009-03-28
10
2,573 Views
Last Modified: 2013-12-12
Hi,

I have a Fedora 9 box where apache, php, mysql .. are running okay. I need to connect from this machine using php to a MS-SQL Server that is in same network. To do this we were trying to install free tds as per article - http://www.linuxjournal.com/article/6636

but while configuring:
[root@localhost]# tar xvfz freetds-0.60.tgz
[root@localhost]# cd freetds-0.60
[root@localhost]# ./configure --with-tdsver=7.0 --with-unixodbc
but this will show a error message -
"configure: sql.h file not found"

I have googeled a lot still dont know how to resolve this sql.h issue or how to get the file.

Will highly appreciate any help on this .. or if any alternative way to connect to MS-SQL server is available .

Thanks and regards,
Sabbir
0
Comment
Question by:Sabbir456
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 12

Expert Comment

by:udaya kumar laligondla
ID: 24012346
you will require the FreeTDS Library from http://www.freetds.org/
you can find the follwoing link contains a step by step of setting up and useing MSSQL in PHP
read the requirements session and more details at http://in.php.net/manual/en/book.mssql.php
0
 

Author Comment

by:Sabbir456
ID: 24016024
To udayakumarlm:

1)  Yes I have downloaded the Freetds .. and while try to configure it on my fedora 9

[root@localhost]# ./configure --with-tdsver=7.0 --with-unixodbcbut this will show a error message - "configure: sql.h file not found"

please refer to my problem details posted earlier.

2) The other link you provided only refer to connecting form windows-php to MSSQL but I need to connect to Linux-php tp MSSQL


0
 
LVL 43

Expert Comment

by:Eugene Z
ID: 24053644
you can try:
HOWTO: Connect RubyOnRails on Fedora Linux to SQL2005
http://www.not404.com/Howto_SQL2005_From_RailsOnFedora 
 
Accessing Microsoft SQL Server (mssql) from PHP under Apache on Unix or Linux
http://www.easysoft.com/developer/languages/php/sql_server_unix_tutorial.html
 
---
also see
"configure: sql.h file not found"
http://lists.ibiblio.org/pipermail/freetds/2008q3/023734.html
http://archives.devshed.com/forums/development-94/tdsodbc-h-26-sql-h-no-such-file-or-directory-982422.html 
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 29

Expert Comment

by:Michael Worsham
ID: 24054380
Since your running Fedora 9, have you tried 'yum install freetds'?
0
 
LVL 29

Accepted Solution

by:
Michael Worsham earned 500 total points
ID: 24054406
Or better yet...

The php-mssql package contains a dynamic shared object that will add MSSQL database support to PHP. It uses the TDS (Tabular DataStream) protocol through the freetds library, hence any database server which supports TDS can be accessed.

http://rpmfind.net/linux/rpm2html/search.php?query=php-mssql

Try: yum install php-mssql
0
 

Author Comment

by:Sabbir456
ID: 24066136
Hi,

I am trying your suggested solutions .. will get back with results. Thanks a lot.

regards,
Sabbir

0
 

Author Comment

by:Sabbir456
ID: 24085178
hi mwecomputers,

both yum install freetds and  yum install php-mssql worked fine.


was able to connect to SQL Server 2005 using mssql_connect
Thanks ...... a lot.

Sabbir


0
 
LVL 29

Expert Comment

by:Michael Worsham
ID: 24086032
Glad I could help.

-- Michael
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question