Php mssql extension on wamp

I am trying to get wamp php to communicate with MsSQL DB, but I can not get it to work. The current error message that I get in the browser (Chrome):

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: (...) Couldn't connect to SQL Server
  • ntwdblib.dll is the correct version (2000.80.194.0)

  • I can not use php_sqlsrv (deployment server - only linux, sqlsrv - only windows), although from the use of sqlsrv I can conclude that the access information is correct (server, user, password)

  • I switched to wampserver 2.1e and php 5.3.1 (some people worked it like this)

  • errors in apache_error.log when restarting wamp server

  • installing freetds on my machine freezes apache

  • the remote computer successfully uses php_mssql.dll (linux server)

The code I'm using is:

<?php
$dbhandle = mssql_connect($ip,$user,$pass) or die("Couldn't connect to SQL Server on $ip"); 
$selected = mssql_select_db($dbname,$dbhandle) or die("Couldn't open database at SQL server: $ip");
?>

linux, , , , ( ).

: Windows 7, Wampserver 2.1e, PHP 5.3.1

?: (

+5
4

, /: http://www.microsoft.com/en-gb/download/details.aspx?id=20098 php.ini * AMP stack PHP..; mssql php/ext...

, MS SQL. http://webcheatsheet.com/php/connect_mssql_database.php

edit: , DB Uname PW serverIP , setCon(), , , .

    function setCon(){
    $conn = mssql_connect($this->server, $this->UName, $this->pw);
    if ($conn){
        echo "Connection established @ $this->server.$this->DB (Connected to MS SQL DB)\n";
    }
    else{
        echo "Connection could not be established.";
        die( print_r( sqlsrv_errors(), true));
    }

.

function getCon(){
    return mssql_connect($this->server, $this->UName, $this->pw);
}
+1

MsSQL? WAMP M MySQL MSSQL.

0

: (...) SQL Server "

- PHP MS-SQL?

, VM - , :)

MDB2 PDO - .

: MS-SQL, . Telnet??

(, , ).

: PECL odbtp >= 1.1.1 ( )

extension=php_mssql.dll

^ , checkout phpinfo() , .

http://www.php.net/manual/en/mssql.installation.php

- mySQL Windows ( , ).

0

wampserver php_mssql.dll, php_pdo_mssql php_dblib. x64 wampserver 2 PHP 5.3.13

  • php_pdo_mssql

    • wampserver
    • php_pdo_mssql
    • php_mssql
    • ntwdblib.dll bin/php/php {version}/ext/ bin/apache/{version}/bin
  • php_dblib

    • php_pdo_mssql php_dblib.

php_pdo_mssql php_dblib.

php wampserver 5.3.1, , 5.3.13 .

0
source

All Articles