Page 1 of 1

Connection to SQL SERVER over network from PHP Apache Server

Posted: Tue Mar 28, 2006 3:25 am
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

Posted: Tue Mar 28, 2006 5:35 am
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

Connection to SQL SERVER over network from PHP Apache Server

Posted: Tue Mar 28, 2006 6:40 am
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

Posted: Tue Mar 28, 2006 9:43 am
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.