How to use PHP & SQL Server (mssql) Connect to Database Learn / tutorial php programming how to using PHP and SQL Server database
ShotDev Focus:
- PHP & Connect to SQL Server
Solution
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: localhost ‘/php_sqlserver.php’
..
PHP Warning: Unknown(): Unable to load dynamic library ‘./php_mssql.dll’ - The specified module could not be found. in Unknown on line 0
Solve Problem
Step 1
Open php.ini -> Start -> Run -> php.ini
copy php_mssql.dll to extension path ………. download file php_mssql.dll
extension_dir = “C:/AppServ\php5\ext”
.
.
.
.
.
extension=php_mssql.dll (Remove ; on file php.ini)
Step 2
Copy ntwdblib.dll to C:\Windows\System32\ ………. download file ntwdblib.dll
Restart Web Server
Example
php_sqlserver.php
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$objConnect = mssql_connect("localhost","sa","");
if($objConnect)
{
echo "Database Connected.";
}
else
{
echo "Database Connect Failed.";
}
mssql_close($objConnect);
?>
</body>
</html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_sqlserver.php
Screenshot



2dominican…
…