1.)
sudo apt-get install php5-sybase
2.)
sudo /etc/init.d/apache2 restart
3.) Third you need to do this: (copied from the internet -- tested it and it works, it will allow you to run stored procs)
“Figured it out...
In researching the problem before posting I saw references to configuration changes needed to FreeTDS, but apparently I was implementing the change wrong, but that is the solution.
- Edit /etc/freetds/freetds.conf
- Edit the section for MSSQL server
- Replace the given section name with something meaningful (we'll say MyServer for this example)
- Enter the IP and port (1433)
- Change the version to 8.0
- Restart Apache
- When connecting to the server (the $conn statement in my example), use the section name that you used in the conf file (MyServer)
- This is the part I was missing when trying to figure out the problem before I posted. I edited the conf file, but was not using the section name to connect.
- Executing the SP will now work.
I've testing this on a clean Ubuntu 9.04 installation following the "reproducting the issue" instructions I provided above and it works like a charm.
Argh...I'd like those hours of my life back now...”
4.) This code ran successfully on the server:
<?php
ini_set('display_errors', 1);
$server = 'MYSERVER';
$link = mssql_connect($server, 'USERNAME', 'MYPASSWORD');
if (!$link) {
die ("Could not connect to database: ".mssql_get_last_message());
}
else {
$selected = mssql_select_db('lynx', $link) or die('cant connect the sql server '.mssql_error());
echo "connected to databasename
";
$result = mssql_query("SELECT COUNT(*) as count FROM tbl_network_account");
while($row = mssql_fetch_array($result))
echo $row["count"] . "
";
}
$network_id = 'aliss';
$stmt = mssql_init('usp_app_msgcenter_faculty_portal_announcements');
mssql_bind($stmt, '@network_id', &$network_id, SQLVARCHAR, false, false, 50);
$proc_result = mssql_execute($stmt) or die('MSSQL error message is: ' . mssql_get_last_message());
mssql_free_statement($stmt);
$row = mssql_fetch_assoc($proc_result);
print_r($row);
?>