Link to home
Start Free TrialLog in
Avatar of drdewm
drdewm

asked on

MSSQL with Apache and PHP on Linux

I can use freetds and php to connect to mssql servers from the command line for example the following returns exactly what is expected:
[root@INTRA1 html]# cat testsql1.php
<?php
$hostname = "database";
$username = "sa";
$password = "";
$dbName = "mydatabase";

MSSQL_CONNECT($hostname,$username,$password) or DIE("DATABASE FAILED TO RESPOND.");
mssql_select_db($dbName) or DIE("Table unavailable");

$query = "SELECT * FROM dbo.cdp";

$result = mssql_query( $query );

for ($i = 0; $i < mssql_num_rows( $result ); ++$i)
     {
         $line = mssql_fetch_row($result);
         print( "$line[0] - $line[1] - $line[2] - $line[3] - $line[4]\n");
     }
?>


BUT trying to run the same code through a browser Apache returns the follwing:
Fatal error: Call to undefined function: mssql_connect() in /var/www/html/testsql1.php on line 7
Any help would be appreciated.
SOLUTION
Avatar of cracky
cracky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial