No se puede conectar a SQL SERVER utilizando los controladores más recientes para PHP

I have been trying to figure out which dll and how to use it to connect to sql server.

It was much easier using the old php_mssql.

I am using Xampp on WinXP Pro SP3. I have been unable to figure out how to connect, i have search the manual, and none of the command's work.

I get PDO Error Driver Not Found

extension-php_pdo_sqlsrv_54_ts.dll extension=php_sqlsrv_54_ts.dll

I realized that I must use the SQLSERV 2.0 Drivers. But which dll is the correct one? And what syntax must I use to connect and run queries?

Gracias por su atención.

preguntado el 26 de agosto de 12 a las 00:08

1 Respuestas

One way of doing this is using FreeTDS for Windows

I am assuming you have PHP >5.3 Download this http://download.moodle.org/download.php/dblib/php53/DBLIB_TS.zip

Agregue esta línea a su php.ini extension=php_dblib.dll

You will also need to make a file called freetds.conf in the root directory of your PHP installation.

Debería verse algo como esto:

[global]
     host = xxx.xxx.xxx.xxx (host name or ip of the MSSQL server)
     port = 1433
     client charset = UTF-8
     tds version = 8.0
     text size = 20971520

Restart Apache and try running this script:

<?php
    $link = mssql_connect('localhost', 'db_user', 'db_password');
    if(!$link) {
        echo'Could not connect';
        die('Could not connect: ' . mssql_error());
    }
    echo'Successful connection';
    mssql_close($link);
?>

hit me up on fb if this does not work ;)

Respondido 26 ago 12, 05:08

Unable to load dynamic library. I am using PHP 5.4 on xampp, and it refuses to load this module. - croenblum

Not sure - I don't have a Windows machine to test on atm. It is running fine on PHP 5.3/CentOS. I think this is exactly what you are looking for though: davehiren.blogspot.com.au/2012/01/… (a tutorial instructing on how to use Microsoft's own new SQL Server drivers for PHP) - Zen

This is for PHP 5.4 Windows Xampp. - croenblum

The link I posted is for PHP 5.3+ on XAMPP (Windows), which is what you have. - Zen

No, according to xampp page, the current version which I recently installed is 5.4.4. Unless their documentation is incorrect. - croenblum

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.