Connection to SQL SERVER over network from PHP Apache Server

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
kamkrish
Forum Newbie
Posts: 2
Joined: Tue Mar 28, 2006 3:08 am

Connection to SQL SERVER over network from PHP Apache Server

Post by kamkrish »

Hi, Can anyone tell me how connect a MS QL SERVER over network from PHP Apache Server based on Red Hat Linux OS.

I created simple demo page to test a connection using System DSN MoAd.
"
$sql="Select * from Users"
$conn=odbc_connect('MoAd','sa','sa');
$rs=odbc_exec($conn,$sql);
$odbc_close($conn);
"

But when i run script from Apache Server i get "Fatal error: Call to undefined function: odbc_connect()"
I belive that Linux doesn't have ODBC for MS SQL SERVER which could identify the function call.

Is there solution for problem.

Regards,
Kamkrish
CyberSpatium
Forum Newbie
Posts: 21
Joined: Thu Mar 20, 2003 12:23 pm
Contact:

Post by CyberSpatium »

Windows has ODBC built in by default, but you need to enable that extention in the php.ini file for linux based systems
kamkrish
Forum Newbie
Posts: 2
Joined: Tue Mar 28, 2006 3:08 am

Connection to SQL SERVER over network from PHP Apache Server

Post by kamkrish »

Thanx for reply CyberSpatium. I got php.ini file...
Can please guide me on what are value that i have chnage so that i can get my MS SQL SERVER up and running.

Regards,
Kamkrish
CyberSpatium
Forum Newbie
Posts: 21
Joined: Thu Mar 20, 2003 12:23 pm
Contact:

Post by CyberSpatium »

open up your php.ini file and enable your odbc extentions. save the file and restart apache for the new settings to take effect.
Post Reply