Hi,
I am struggleing to connect to a MS SQL database through PHP. My php version is 5.3.10-1ubuntu3.2 and as u might guess from the version name it runs on an Ubuntu machine.
I found out that PHP 5.3 doesn't directly support connecting to MS SQL and I need to install a driver from MS for it. Could this be installed on Linux ? Is it a stable way to connect to MS SQL ? Is there any better way to do so ?
Thanks alot for your help,
Shahab
PHP 5.3 connecting to MSSQL
Moderator: General Moderators
Re: PHP 5.3 connecting to MSSQL
Do you have php5-sybase installed?
Re: PHP 5.3 connecting to MSSQL
Hi,
No I didn't have it installed. Now I have and I have followed this tutorial with no luck ...
http://jamesrossiter.wordpress.com/2011 ... l_connect/
The server gives an error on running first line ($server = ‘my.server.ip:1433\DATABASEINSTANCE’;) which ofcourse I updated with my own information
As you see even the deactivated code (only the 2nd line) makes the code to crash ...
No I didn't have it installed. Now I have and I have followed this tutorial with no luck ...
http://jamesrossiter.wordpress.com/2011 ... l_connect/
The server gives an error on running first line ($server = ‘my.server.ip:1433\DATABASEINSTANCE’;) which ofcourse I updated with my own information
Code: Select all
<?php
ini_set(‘display_errors’, 1);
$server = ‘myIP,1433’;
$link = mssql_connect($server, ‘user’, ‘pass’);
/*
if (!$link) {
die(‘<br/><br/>Something went wrong while connecting to MSSQL’);
}
else {
$selected = mssql_select_db(“ob_reportingDB”, $link)
or die(“Couldn’t open database databasename”);
echo “connected to databasename<br/>”;
$result = mssql_query(“SELECT * FROM [ob_reportingDB].[dbo].[PRODUCTION_HEADER]”);
while($row = mssql_fetch_array($result))
echo $row["name"] . “<br/>”;
}
*/
?>
<html>
<head>
</head>
<body>
Yohohohohohohohoho
</body>
</html>