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,$u sername,$p assword) 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.
[root@INTRA1 html]# cat testsql1.php
<?php
$hostname = "database";
$username = "sa";
$password = "";
$dbName = "mydatabase";
MSSQL_CONNECT($hostname,$u
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
Any help would be appreciated.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.