
<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Màrius Duch &#187; sql server</title> <atom:link href="http://www.mariusduch.es/sobre/sql-server/feed" rel="self" type="application/rss+xml" /><link>http://www.mariusduch.es</link> <description>Informática práctica para todos</description> <lastBuildDate>Wed, 19 Oct 2011 10:29:40 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <item><title>Error al realizar una conexión con PHP a SQL Server desde Windows</title><link>http://www.mariusduch.es/error-al-realizar-una-conexion-con-php-a-sql-server-desde-windows</link> <comments>http://www.mariusduch.es/error-al-realizar-una-conexion-con-php-a-sql-server-desde-windows#comments</comments> <pubDate>Fri, 16 Jul 2010 12:47:11 +0000</pubDate> <dc:creator>Màrius</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[php4]]></category> <category><![CDATA[sql server]]></category> <category><![CDATA[windows 2003]]></category> <guid
isPermaLink="false">http://www.mariusduch.es/?p=987</guid> <description><![CDATA[El otro día tuve que hacer funcionar una web programada en  PHP4 con un IIS6 en un servidor Windows 2003 Server y la verdad es que no fue tarea fácil, debido a que nunca había realizado ninguna instalación de de PHP4 en Windows, ya que normalmente trabajamos con ASP en Windows y PHP en Linux. [...]]]></description> <content:encoded><![CDATA[<p><img
class="alignleft size-full wp-image-994" title="error-al-realizar-una-conexion-con-php-a-sql-server-desde-windows" src="http://www.mariusduch.es/wp-content/uploads/error-al-realizar-una-conexion-con-php-a-sql-server-desde-windows.png" alt="" width="100" height="100" />El otro día tuve que hacer funcionar una web programada en  PHP4 con un IIS6 en un servidor Windows 2003 Server y la verdad es que no fue tarea fácil, debido a que nunca había realizado ninguna <a
href="http://www.mariusduch.es/instalar-php4-en-windows-2003-server" target="_self">instalación de de PHP4 en Windows</a>, ya que normalmente trabajamos con ASP en Windows y PHP en Linux.</p><p>Finalmente, después de conseguir instalar el PHP4, tuve que hacer que la web se pudiera conectar con un SQL Server, así que habilité la extensión php_mssql en el php.ini para que funcionara.</p><p>Entonces hice un fichero de prueba (test.php) para comprobar si realmente podía conectarme a una base de datos, y me encontré con lo siguiente:<br
/> <span
id="more-987"></span><br
/> <strong>Contenido del fichero test.php para ver si podemos establecer conexión con una base de datos SQL Server:</strong></p><blockquote><p>$server = &#8216;IP_DEL_SERVIDOR&#8217;;<br
/> $user = &#8216;USUARIO_BASE_DE_DATOS&#8217;;<br
/> $password = &#8216;CONTRASEÑA_USUARIO&#8217;;<br
/> $db = &#8216;NOMBRE_BASE_DE_DATOS&#8217;;</p><p>$conexion = mssql_connect($server, $user, $password);<br
/> mssql_select_db($db, $conexion);</p><p>var_dump($conexion);</p></blockquote><p><strong>Error que mostró el navegador:</strong></p><blockquote><p><strong>Warning:</strong> mssql_connect() [function.mssql-connect]: Unable to connect to server: xxx.xxx.xxx.xxx in C:\Inetpub\wwwroot\NOMBRE_WEB\test.php on line 10</p><p><strong>Warning:</strong> mssql_select_db(): supplied argument is not a valid MS SQL-Link resource in C:\Inetpub\wwwroot\NOMBRE_WEB\test.php on line 11<br
/> bool(false)</p></blockquote><p><strong>Razón del problema:</strong><br
/> La versión del fichero <em>C:\WINDOWS\system32\ntwdblib.dll</em> es antigua.<br
/> Si miramos las propiedades del fichero veremos que tiene la versión 2000.2.8.0<br
/> <img
class="aligncenter size-full wp-image-988" title="ntwdblib-1" src="http://www.mariusduch.es/wp-content/uploads/ntwdblib-1.png" alt="" width="291" height="153" /></p><p><strong>Solución del problema:</strong></p><p>Descargamos el fichero <em>ntwdblib.rar</em> pulsando <a
href="http://www.mariusduch.es/wp-content/uploads/ntwdblib.rar">AQUÍ</a></p><p>Descomprimimos el fichero y obtendremos el fichero <em>ntwdblib.dll</em></p><p>Movemos el fichero a la carpeta <em>C:\WINDOWS\system32</em></p><p>Si miramos la versión, veremos que ahora es diferente, es la 2000.80.194.0</p><p><img
class="aligncenter size-full wp-image-990" title="ntwdblib-2" src="http://www.mariusduch.es/wp-content/uploads/ntwdblib-2.png" alt="" width="291" height="153" /></p><p>Reiniciamos IIS</p> ]]></content:encoded> <wfw:commentRss>http://www.mariusduch.es/error-al-realizar-una-conexion-con-php-a-sql-server-desde-windows/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
