SQL Server Driver for PHP ForumForum for the SQL Server Driver for PHP which is designed to enable reliable, scalable integration with SQL Server for PHP applications on the Windows Platform© 2009 Microsoft Corporation. All rights reserved.Wed, 25 Nov 2009 23:05:59 Z325db3f8-bd74-4d6d-bf84-109416629a0ehttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/3d72c630-fa1d-4e44-b6ee-b2eaf7c1f967http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/3d72c630-fa1d-4e44-b6ee-b2eaf7c1f967Lace666http://social.msdn.microsoft.com/Profile/en-US/?user=Lace666Hint: querying stored procedures with php driver 1.1 with output parametersI had a nasty problem for the last two days. I have some stored procedures on my sql server 2008 with (interger) output parameters.<br/> I was able to query those procedures without any error, but I wasn´t getting back any result values in my output parameters.<br/> <br/> I now have a solution I want to share with this forum.<br/> <br/> This problem occurs if inside the stored procedure are any nested queries results. You can see if there are additional results inside the procedure by testing the stored procedure in SQL Management studio and getting back several &quot;XXX rows affected&quot; lines in the messages window.<br/> <br/> If you follow the PHP driver Programming Guide for Directional Parameters you will fail in the described situation.<br/> <br/> The source of the problem is how the sql server protocol is handling the parameter transfer:<br/> http://msdn.microsoft.com/en-us/library/ms403283.aspx<br/> <br/> The problem is, the parameters are transfered as the last packet over the network. The driver is traversing the results one by one, with the ouput parameters read AFTER all other results have been read. Each &quot;XXX rows affected&quot; will become a result to be (manually, triggerd) read from the server - if you read this &quot;garbage&quot; resuls with sqlsrv_fetch_array or similar you will see something like &quot;the result set contains no data&quot; as an returned server error.<br/> <br/> You just have to skip this &quot;garbage&quot; to get your output parameters as results. You can skip those with the following commands:<br/> <br/>         $tsql_callSP = &quot;{call dbo.aStoredProcWithOutputParam(?)}&quot;;<br/> <br/>         $params = array(<br/>               array (<br/>                  $outputvar, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT, SQLSRV_SQLTYPE_INT,<br/>                )<br/>             );<br/>         <br/>         $stmt = sqlsrv_query( $con, $tsql_callSP, $params);<br/> <br/>         --- Now you have to skip all garbage<br/>         $loop = true;<br/>         while ($loop)<br/>         {<br/>           $loop = sqlsrv_next_result( $stmt );<br/>         }<br/> <br/>          This will iterate through all results until (internally in the driver) <span><strong>SQLMoreResults</strong> returns SQL_NO_DATA</span> -&gt; now Output Parameters are ready to be read because the last result data packet has been transfered from the server to the client, which contains the output parameters.<br/> <br/>        echo $outputvar<br/> <br/>        It is NECESSARY that you loop through with a while clause because there can be several &quot;garbage&quot; results.<br/> <br/>        If you don´t do the described iteration, you will not have a result in your output parameter php variables. I am not sure wether this problem only occurs in the case the output parameter is an integer (as described in the Microsoft article &quot;Process Return Codes and Output Parameter&quot;). In my case the output parameters were of an integer type.<br/> <br/> Please be careful if you have results from a select command as a stored proc result. Make sure that you don´t skip them if you need them. I doesn´t tested this situation so I just want to warn you that you may get the output parameters but accidentially skip the other results from the stored proc.<br/>Fri, 20 Nov 2009 12:35:05 Z2009-11-25T23:05:59Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/6249c7db-3fa8-4a59-9aaf-3098512c7cddhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/6249c7db-3fa8-4a59-9aaf-3098512c7cddÁlvaro G. Vicariohttp://social.msdn.microsoft.com/Profile/en-US/?user=%u00c1lvaro%20G.%20VicarioErrors appear twice in sqlsrv_errors()First day with SQL Server Driver for PHP...<br/> <br/> I'm checking the result of the call to sqlsrv_connect() so I can throw an exception in my code. I enter wrong credentials and I call to sqlsrv_errors() to get the error message. Curiously, I always get the same error messages twice. E.g., a wrong password:<br/> <br/> <pre>Array<br/> (<br/> [0] =&gt; Array<br/> (<br/> [0] =&gt; 28000<br/> [SQLSTATE] =&gt; 28000<br/> [1] =&gt; 18456<br/> [code] =&gt; 18456<br/> [2] =&gt; [Microsoft][SQL Server Native Client 10.0][SQL Server]Error de inicio de sesión del usuario 'sa'.<br/> [message] =&gt; [Microsoft][SQL Server Native Client 10.0][SQL Server]Error de inicio de sesión del usuario 'sa'.<br/> )<br/> <br/> [1] =&gt; Array<br/> (<br/> [0] =&gt; 28000<br/> [SQLSTATE] =&gt; 28000<br/> [1] =&gt; 18456<br/> [code] =&gt; 18456<br/> [2] =&gt; [Microsoft][SQL Server Native Client 10.0][SQL Server]Error de inicio de sesión del usuario 'sa'.<br/> [message] =&gt; [Microsoft][SQL Server Native Client 10.0][SQL Server]Error de inicio de sesión del usuario 'sa'.<br/> )<br/> <br/> )<br/> </pre> Now wrong database:<br/> <br/> <pre>Array ( [0] =&gt; Array ( [0] =&gt; 28000 [SQLSTATE] =&gt; 28000 [1] =&gt; 18456 [code] =&gt; 18456 [2] =&gt; [Microsoft][SQL Server Native Client 10.0][SQL Server]Error de inicio de sesión del usuario 'sa'. [message] =&gt; [Microsoft][SQL Server Native Client 10.0][SQL Server]Error de inicio de sesión del usuario 'sa'. ) [1] =&gt; Array ( [0] =&gt; 42000 [SQLSTATE] =&gt; 42000 [1] =&gt; 4060 [code] =&gt; 4060 [2] =&gt; [Microsoft][SQL Server Native Client 10.0][SQL Server]No se puede abrir la base de datos &quot;xxxICCL_ITCWEB_WEB&quot; solicitada por el inicio de sesión. Error de inicio de sesión. [message] =&gt; [Microsoft][SQL Server Native Client 10.0][SQL Server]No se puede abrir la base de datos &quot;xxxICCL_ITCWEB_WEB&quot; solicitada por el inicio de sesión. Error de inicio de sesión. ) [2] =&gt; Array ( [0] =&gt; 28000 [SQLSTATE] =&gt; 28000 [1] =&gt; 18456 [code] =&gt; 18456 [2] =&gt; [Microsoft][SQL Server Native Client 10.0][SQL Server]Error de inicio de sesión del usuario 'sa'. [message] =&gt; [Microsoft][SQL Server Native Client 10.0][SQL Server]Error de inicio de sesión del usuario 'sa'. ) [3] =&gt; Array ( [0] =&gt; 42000 [SQLSTATE] =&gt; 42000 [1] =&gt; 4060 [code] =&gt; 4060 [2] =&gt; [Microsoft][SQL Server Native Client 10.0][SQL Server]No se puede abrir la base de datos &quot;xxxICCL_ITCWEB_WEB&quot; solicitada por el inicio de sesión. Error de inicio de sesión. [message] =&gt; [Microsoft][SQL Server Native Client 10.0][SQL Server]No se puede abrir la base de datos &quot;xxxICCL_ITCWEB_WEB&quot; solicitada por el inicio de sesión. Error de inicio de sesión. ) ) </pre> My code is pretty straightforward:<br/> <br/> <pre>&lt;?php $conn = sqlsrv_connect('server\\instance', array( 'UID' =&gt; 'user', 'PWD' =&gt; 'password', 'Database' =&gt; 'database', )); if( !$conn ){ $e = sqlsrv_errors(); print_r($); } ?&gt;</pre> Why do they show up twice?Tue, 24 Nov 2009 17:54:03 Z2009-11-24T17:54:04Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/e011dd5d-c925-4a08-9452-0c1c2e411b49http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/e011dd5d-c925-4a08-9452-0c1c2e411b49Adiaszhttp://social.msdn.microsoft.com/Profile/en-US/?user=AdiaszProblem with sqlsrv_num_rows in 'CTE' MSSQL selects. (strange return value -1)Hello<br/> <br/> <p style="margin-bottom:0cm"><strong>What I want:</strong></p> <p style="margin-bottom:0cm">I want to get data records from database using „CTE - Common Table Expression”.</p> <p style="margin-bottom:0cm"> </p> <p style="margin-bottom:0cm">Sample CTE (listing 1):</p> <pre><code>„$sql = &quot;;WITH unsorted_cte AS</code> <br/> <code>(</code> <br/> <code>  SELECT</code> <br/> <code>    *</code> <br/> <code>  FROM</code> <br/> <code>    xxx</code> <br/> <code>  WHERE</code> <br/> <code>    yyy</code> <br/> <code>)</code> <br/> <code>SELECT</code> <br/> <code>  u_cte.*</code> <br/> <code>FROM</code> <br/> <code>  [unsorted_cte] u_cte</code> <br/> <code>ORDER BY</code> <br/> <code>    u_cte.[zzzz] ASC&quot;;”</code> <br/> </pre> <p style="margin-bottom:0.5cm"><code>When I test this query in sql console the @@rowcount have proper value, but when I use this select in php script <strong>function sqlsrv_num_rows returns strange value -1</strong> . This value is not even in functinon docs http://msdn.microsoft.com/en-us/library/ee376931(SQL.90).aspx.</code></p> <p style="margin-bottom:0.5cm"><code>I need to know the proper amount of returned rows before I will fetch rows data from database.</code></p> <br/> <br/> <p style="margin-bottom:0.5cm"><code>Sample PHP code (listing 2):</code></p> <pre><code>// make query with proper coursor</code> <code>$result = sqlsrv_query($link, $sql, array(), array( &quot;Scrollable&quot; =&gt; SQLSRV_CURSOR_KEYSET));</code> <code>// var dump shows us proper resource</code> <code>var_dump($result);</code> <code>resource(3) of type (SQL Server Statement)</code> <code>// sqlsrv_num_rows show us wrong rows count</code> <code>var_dump(sqlsrv_num_rows($result));</code> <code>int(-1)</code> <code>// sqlsrv_errors are empty</code> <code>var_dump(sqlsrv_errors());</code> <code>NULL</code> </pre> <p style="margin-bottom:0.5cm"><br/></p> <p style="margin-bottom:0.5cm"><code>Whats curious: when we loop the $result object before using sqlsrv_num_rows() function (listing 3):</code></p> <pre><code>// make query with proper coursor</code> <code>$result = sqlsrv_query($link, $sql, array(), array( &quot;Scrollable&quot; =&gt; SQLSRV_CURSOR_KEYSET));</code> <code>// empty loop with it only iterates $result object with no assigns</code> <code>while($row = sqlsrv_fetch_object($result)) {</code> } <code>// sqlsrv_num_rows show us proper rows amount</code> <code>var_dump(sqlsrv_num_rows($result));</code> <code>int(16)</code> </pre> <br/> <p style="margin-bottom:0.5cm"><code><span style="font-family:DejaVu Sans,sans-serif">I tried to come around this problem by counting returned rows in empty loop (listing 3) and then in application make another loop with Selecting Rows in a Result Set by SQLSRV_SCROLL_ABSOLUTE or return scroll pointer to first by SQLSRV_SCROLL_FIRST. Unfortunately the only  Selecting Rows parameter that works is default SQLSRV_SCROLL_NEXT, so I cant get to rows data again in applications.</span> </code></p> <br/> <br/> <p style="margin-bottom:0cm"><strong>My Environment:</strong></p> <p style="margin-bottom:0cm">PHP 5.3</p> <p style="margin-bottom:0cm">MSSQL 2005</p> <p style="margin-bottom:0cm">Windows Server</p> <p style="margin-bottom:0cm">SQL Server Driver for PHP 1.1 ( <span style="color:#000080"><span style="text-decoration:underline"><a href="http://msdn.microsoft.com/en-us/library/ee229548(SQL.10).aspx">http://msdn.microsoft.com/en-us/library/ee229548(SQL.10).aspx</a> </span> </span> )</p> <p style="margin-bottom:0cm">Database encoding: unicode</p> <p style="margin-bottom:0cm"> </p> <p style="margin-bottom:0cm"> </p> <p style="margin-bottom:0cm">&lt;!-- @page { size: 21cm 29.7cm; margin: 2cm } P { margin-bottom: 0.21cm } CODE { font-family: &quot;DejaVu Sans Mono&quot;, monospace } --&gt; <p><code><span style="font-family:DejaVu Sans,sans-serif">Please help me,<strong> how can I get proper value of </strong> </span> </code> <code><strong>sqlsrv_num_rows() function with CTE queries</strong> .</code></p> </p>Tue, 24 Nov 2009 10:10:31 Z2009-11-24T10:10:32Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/4a8d822f-83b5-4eac-a38c-6c963b386343http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/4a8d822f-83b5-4eac-a38c-6c963b386343Zan73http://social.msdn.microsoft.com/Profile/en-US/?user=Zan73query timing outI'm running a php script from the command line against SQL server 2005 using the MS driver for PHP and getting time outs. The query takes about 2 minutes from SQL Server Management Studio and returns &gt; 300,000 rows. There are multiple queries in the script and for each one I do a sqlsrv_connect(), execute the query and then sqlsrv_free_stmt() and sqlsrv_close() Output from sqlsrv_errors():  <pre>Array ( [0] =&gt; Array ( [0] =&gt; 08S01 [SQLSTATE] =&gt; 08S01 [1] =&gt; 258 [code] =&gt; 258 [2] =&gt; [Microsoft][SQL Native Client]Shared Memory Provider: Timeout error [258]. [message] =&gt; [Microsoft][SQL Native Client]Shared Memory Provider: Timeout error [258]. ) [1] =&gt; Array ( [0] =&gt; 08S01 [SQLSTATE] =&gt; 08S01 [1] =&gt; 258 [code] =&gt; 258 [2] =&gt; [Microsoft][SQL Native Client]Communication link failure [message] =&gt; [Microsoft][SQL Native Client]Communication link failure ) [2] =&gt; Array ( [0] =&gt; 08S01 [SQLSTATE] =&gt; 08S01 [1] =&gt; 0 [code] =&gt; 0 [2] =&gt; [Microsoft][SQL Native Client]Communication link failure [message] =&gt; [Microsoft][SQL Native Client]Communication link failure ) ) </pre> <br/>Wed, 04 Nov 2009 02:55:45 Z2009-11-24T00:46:16Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/46cb4626-716f-4fd7-af49-4b6fe1e5b955http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/46cb4626-716f-4fd7-af49-4b6fe1e5b955_Mike_F_http://social.msdn.microsoft.com/Profile/en-US/?user=_Mike_F_storing UTF-8 data in VARCHAR or NVARCHAR?I am able to successfully store and retrieve UTF-8 Chinese characters in a SQL Server 2008 database using the PHP driver, version 1.1 (SQLNCLI10.DLL). <br/><br/>According to the PHP driver documentation, using NVARCHAR and <span style="font-family:Courier New">&quot;CharacterSet&quot; =&gt; &quot;UTF-8&quot; </span>is required for UTF-8.  However, I am using neither of these.  I am using VARCHAR fields which require half of the disk space.<br/><br/>When I query the database using MSSQL Management Studio, the text looks like junk.  However, my webpages display the Chinese characters stored in the database correctly as long as I specifiy <span class="HTML_TXT"><span class="HTML_TAG"><span style="color:#0000ff">&lt;</span><span class="HTML_ELM"><span style="color:#800000">meta</span></span><span style="color:#0000ff"> </span><span class="HTML_ATR"><span style="color:#ff0000">content</span></span><span style="color:#0000ff">=<span class="HTML_VAL">&quot;text/html; charset=utf-8&quot;</span> </span><span class="HTML_ATR"><span style="color:#ff0000">http-equiv</span></span><span style="color:#0000ff">=<span class="HTML_VAL">&quot;Content-Type&quot;</span> /&gt; </span></span></span>in the header section.<br/><br/>Is the documentation incorrect? Or is what I am doing a hack which will cause problems for me later?  Thanks.<br/><br/><br/><br/>   <p> </p>Thu, 19 Nov 2009 08:59:31 Z2009-11-21T10:56:28Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/2d20aff1-034e-4456-a8a5-2f216221051chttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/2d20aff1-034e-4456-a8a5-2f216221051cWill Crofthttp://social.msdn.microsoft.com/Profile/en-US/?user=Will%20CroftNested stored procedure silent timeout?Hi,<br/><br/>Is there any form of implicit timeout for the execution of a stored procedure via the SQL PHP driver?<br/><br/>I am calling to a stored procedure that updates values that already exist and inserts new ones. For the insert part, there is a nested call to another stored procedure within the first which performs the actual insertion of a data point given a value and some metadata. I am finding that often the script reports success (and there is no sqlsrv_errors() output aside from '1' for success), but checking with the database, only a subset of values have been inserted. If I then run the same stored procedure in management studio on the same machine, all the values are picked up and inserted successfully. <br/><br/>If it helps, I am updating values in the first instance via a single UPDATE statement across a join. The insert part is then a loop through all the rows that are new which are then passed to this nested stored procedure.<br/><br/>I have tried this call using both the raw EXEC syntax and the recommended { CALL xxx } syntax but I see the same problems.<br/><br/>Lastly I am not seeing this same problem via any of my other inline queries (i.e. those not using stored procedures).<br/><br/>I am using SQL Server 2005 and PHP 5.3 with the 1.1 non-thread-safe dll compiled for VC6. I have the latest SQL 2008 native client installed from the April update pack.<br/><br/>Many thanks for any potential help.<br/><br/>Thanks,<br/>-WillThu, 22 Oct 2009 15:45:38 Z2009-11-20T00:49:05Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/ed7df76b-e16a-4bc8-91aa-785f755e6e9dhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/ed7df76b-e16a-4bc8-91aa-785f755e6e9delvi5http://social.msdn.microsoft.com/Profile/en-US/?user=elvi5connecting multiple databases with sqlsrv_connectMay I know how to connect to different tables from 2 different database instances in in one sqlsrv_connect function? I would like to query 2 different tables, one containing invoice information, and another one containing my customers' billing details. Please help!<br/> <br/> For example:<br/> <br/> select * from dbase1.invoices a, dbase2.customers b where a.cust_id = b.cust_idFri, 06 Nov 2009 04:07:44 Z2009-11-07T14:24:59Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/b261385f-6a34-4199-b98b-5c1e20a87009http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/b261385f-6a34-4199-b98b-5c1e20a87009DavidDmsVcp - MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=DavidDmsVcp%20-%20MSFTSQL Server Driver for PHP 1.1 is now available<p class="MsoNormal"><strong><span style="COLOR: black">SQL Server Driver for PHP 1.1 is now available&nbsp;</span></strong><span style="COLOR: black">&nbsp;</span></p> <p class="MsoNormal"><span style="COLOR: black">SQL Server Driver for PHP 1.1 has released!&nbsp;&nbsp;</span><span style="COLOR: black">&nbsp;</span></p> <p class="MsoNormal"><span style="COLOR: black">The SQL Server Driver for PHP team would like to thank everyone who has provided feedback and bug reports throughout the development cycle for the driver.&nbsp;&nbsp;</span><span style="COLOR: black">&nbsp;</span></p> <p class="MsoNormal"><span style="COLOR: black">This release marks a very big milestone in our continued&nbsp;pursuit for interoperability while also providing support for PHP&nbsp;ver 5.3.&nbsp;&nbsp; This driver will enable developers to build PHP applications with relational&nbsp;database capabilities&nbsp;to both SQL Server as well as SQL Azure databases.&nbsp;&nbsp;&nbsp;There are some key performance improvements as well as new features such as support for UTF-8 encoding and scrollable result sets.&nbsp;&nbsp;&nbsp;</span></p> <p class="MsoNormal"><span style="COLOR: black">&nbsp;<span style="COLOR: black"><strong>What about the source?</strong></span></span></p> <p class="MsoNormal" style="MARGIN-LEFT: 0.5in"><span style="COLOR: black">The driver is available for download on the <a title="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9" href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9" target="_blank"><span style="COLOR: windowtext" title="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9"><strong>MSDN download site</strong></span></a>.&nbsp; We encourage you to download the driver and explore the sample application described in the .chm file.&nbsp; If you'd prefer to access our documentation on-line, it's available on the <a title="http://msdn.microsoft.com/en-us/library/ee229548(SQL.10).aspx" href="http://msdn.microsoft.com/en-us/library/ee229548(SQL.10).aspx" target="_blank"><span style="COLOR: windowtext" title="http://msdn.microsoft.com/en-us/library/ee229548(SQL.10).aspx"><strong>MSDN site</strong></span></a>.&nbsp; We welcome your feedback, feature requests and bug reports on our <a title="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=2108&amp;SiteID=1" href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=2108&amp;SiteID=1" target="_blank"><span style="COLOR: windowtext" title="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=2108&amp;SiteID=1"><strong>MSDN Forum</strong></span></a>.</span></p> <p class="MsoNormal"><span style="COLOR: black">&nbsp;</span></p> <p class="MsoNormal"><strong><span style="COLOR: black">What about the source?</span></strong></p> <p class="MsoNormal" style="MARGIN-LEFT: 0.5in"><span style="COLOR: black">Microsoft has published the source code to the driver on the <a title="CodePlex" href="http://www.codeplex.com/SQLSRVPHP" target="_blank"><span style="COLOR: windowtext" title="http://www.codeplex.com/SQL2K5PHP"><strong>CodePlex</strong></span></a> site.&nbsp; There, you can download the source code and provide feedback in the form of bug reports and feature requests.</span></p> <p class="MsoNormal" style="MARGIN-LEFT: 0.5in">&nbsp;</p> <p class="MsoNormal" style="MARGIN-LEFT: 0.5in"><span style="COLOR: black">We understand that many developers will download the source code from CodePlex to create their own build(s) of the driver.&nbsp; However, Microsoft supports only the signed version of the driver from the MSDN download site.&nbsp; If you're using a custom built version of the driver and encounter problems, please reproduce the problem with the Microsoft-built driver before contacting Microsoft support.</span></p> <p class="MsoNormal"><span style="COLOR: black">&nbsp;</span></p> <p class="MsoNormal"><strong><span style="COLOR: black">How will Microsoft respond to feedback and update the driver?</span></strong></p> <p class="MsoNormal" style="MARGIN-LEFT: 0.5in"><span style="COLOR: black">We will be responsive to feedback on the MSDN Forum, Codeplex, and through our <a href="http://blogs.msdn.com/sqlphp/"><strong>blog</strong></a>, weighing in on both feature requests and bug reports.&nbsp; </span></p>Wed, 19 Aug 2009 21:57:38 Z2009-11-03T14:09:40Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/408e5a94-e3a4-470d-9fc3-2f596757ce3dhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/408e5a94-e3a4-470d-9fc3-2f596757ce3dnishantnigamhttp://social.msdn.microsoft.com/Profile/en-US/?user=nishantnigamApache crashes with An unhadled win32 exception encountered at httpd.exe.Hiii, <div><br/></div> <div>I'm using PHP5.2.6 (Thread safe version), with apache 2.2.8 where PHp is running as a module. on a windows server 2003 machine.</div> <div><br/></div> <div>I'm using Sql Server driver for PHP.</div> <div>But while i'm uploading csv files to server and inserting its data into sql server , sometimes i get &quot;Just in time debugger eroor &quot; which states that &quot;An unhandled Win32 exception occurred in httpd.exe&quot;.</div> <div><br/></div> <div>and after that server stops responding , but after restarting Apcahe few times the error goes off and evrything work smoothly.</div> <div><br/></div> <div>The Apache error logs shows </div> <div>&quot;</div> <div> <div>[Mon Nov 02 18:08:19 2009] [notice] Child 5880: Child process is running</div> <div>[Mon Nov 02 18:08:19 2009] [notice] Child 5880: Acquired the start mutex.</div> <div>[Mon Nov 02 18:08:19 2009] [notice] Child 5880: Starting 64 worker threads.</div> <div>[Mon Nov 02 18:08:19 2009] [notice] Child 5880: Starting thread to listen on port 80.</div> <div>[Mon Nov 02 18:09:06 2009] [notice] Parent: Received restart signal -- Restarting the server.</div> <div>[Mon Nov 02 18:09:06 2009] [notice] Child 5880: Exit event signaled. Child process is ending.</div> </div> <div>&quot;</div> <div><br/></div> <div>and on debug it show &quot;<span style="font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;color:#333333;line-height:16px">faulting module php5ts.dll version 5.2.6, fault address 0x0000afef (which is random address&quot;...</span></div> <div><span style="font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;color:#333333;font-size:small"><span style="font-size:13px;line-height:16px"><br/></span></span></div> <div><span style="font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;color:#333333;font-size:small"><span style="font-size:13px;line-height:16px">Plz help me sort out the issue as its just freaking me out.....</span></span></div> <div><span style="font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;color:#333333;font-size:small"><span style="font-size:13px;line-height:16px"><br/></span></span></div> <div><span style="font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;color:#333333;font-size:small"><span style="font-size:13px;line-height:16px">Plzzzzzzzzzzzzz</span></span></div>Tue, 03 Nov 2009 11:45:26 Z2009-11-03T11:45:27Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/835d2601-439b-40b7-98e2-4abfb80e53d7http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/835d2601-439b-40b7-98e2-4abfb80e53d7royroeshttp://social.msdn.microsoft.com/Profile/en-US/?user=royroesSpecified driver could not be loaded due to system error 127 (SQL Server Native Client 10.0).<p>My configuration is:<br/>PHP 5.3<br/>SQL Server 2005 Express<br/>SQL Server Driver for PHP 1.1<br/>Microsoft SQL Server 2008's SQL Server Native Client<br/><br/>When I run the sql server connection function in php, i get the following error message:<br/>&quot;Specified driver could not be loaded due to system error 127 (SQL Server Native Client 10.0).&quot;<br/><br/>SQLSTATE: IM003<br/>Code: 160<br/><br/>How can i fix this error?</p>Fri, 18 Sep 2009 16:07:39 Z2009-11-02T08:27:04Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/98cb41d2-e024-41af-9ebc-a3774aa835efhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/98cb41d2-e024-41af-9ebc-a3774aa835efMaggie62http://social.msdn.microsoft.com/Profile/en-US/?user=Maggie62Visual Studio Data source not foundIn MS Visual Studio I am getting the message: Data Source was not found, yet when I test my connection, it tells me it succeeded.<br/>What am I doing wrong?Wed, 28 Oct 2009 04:07:33 Z2009-10-28T07:13:07Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/c70d9b87-eacc-483e-a743-02ef4aba07f5http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/c70d9b87-eacc-483e-a743-02ef4aba07f5hanimhttp://social.msdn.microsoft.com/Profile/en-US/?user=hanimhow to solve my problem??i think the problem is from my table... anybody can help me please?<br/> its very important.. the insert query not have a problem because i already test it using command promt and successfull.. after i aplly it into my form.. its cannot function. and this my fisrt new database using.. postgre, using php...<br/> <br/> <br/> //this my form//<br/>     &lt;form action=&quot;f_loan_sport.php&quot; method=&quot;post&quot; name=&quot;myForm&quot; class=&quot;style4&quot;&gt;<br/>     <br/>      <br/>     <br/>         &lt;td&gt;&lt;p align=&quot;center&quot; class=&quot;style4&quot;&gt;&amp;nbsp;&lt;/p&gt;<br/>                 <br/>           &lt;div align=&quot;left&quot;&gt;            &lt;br&gt;<br/>             <br/>     &lt;table width=&quot;386&quot; border=&quot;0&quot;&gt;<br/>               &lt;tr&gt;<br/>                 &lt;td width=&quot;157&quot;&gt;Select Your Item Borrow:&lt;/td&gt;<br/>                 &lt;td width=&quot;124&quot;&gt;&lt;select name=&quot;choose_equ&quot; id=&quot;choose_equ&quot;&gt;<br/>                   &lt;option&gt;-SELECT-&lt;/option&gt;<br/>                   &lt;option value=&quot;B&quot;&gt;BADMINTON&lt;/option&gt;<br/>                   &lt;option value=&quot;BJ&quot;&gt;BOLA JARING&lt;/option&gt;<br/>                   &lt;option value=&quot;T&quot;&gt;TENNIS&lt;/option&gt;<br/>                   &lt;option value=&quot;BS&quot;&gt;BOLA SEPAK&lt;/option&gt;<br/>                   &lt;option value=&quot;BL&quot;&gt;BOLA BALING&lt;/option&gt;<br/>                   &lt;option value=&quot;BK&quot;&gt;BOLA KERANJANG&lt;/option&gt;<br/>                   &lt;option value=&quot;H&quot;&gt;HOKI&lt;/option&gt;<br/>                   &lt;option value=&quot;KB&quot;&gt;KEPERLUAN BILIK&lt;/option&gt;<br/>                                 &lt;/select&gt;&lt;/td&gt;<br/>                 &lt;td width=&quot;83&quot; bgcolor=&quot;#FFFFFF&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;SELECT&quot; &gt;&lt;/td&gt;<br/>               &lt;/tr&gt;<br/>               &lt;tr&gt;<br/>                 &lt;td&gt;Date Borrow:&lt;/td&gt;<br/>                 &lt;td&gt;&lt;input id=MyDate name=MyDate type=&quot;text&quot; size=15 &gt;                  &lt;a href=&quot;JavaScript:;&quot; onClick=&quot;toggleCalendar('MyDate')&quot;&gt;&lt;img src=&quot;images/cal.gif&quot; width=&quot;28&quot; height=&quot;27&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/td&gt;<br/>               &lt;/tr&gt;<br/>             &lt;/table&gt;<br/> &lt;?php<br/> session_start();<br/> <br/> $stud_id=$_SESSION['stud_id'];<br/> $stud_name=$_SESSION['stud_name'];<br/> <br/> $dbh = pg_connect(&quot;host=localhost dbname=laon user=postgres password=zuraihanim&quot;);<br/>      <br/> if(isset($_POST['Submit'])){<br/> <br/> $choose_equ=$_POST['choose_equ'];<br/> }<br/> $sql = &quot;SELECT * FROM equ_detail where equ_type_detail = '$choose_equ'  ORDER BY equ_name , equ_se_num ASC &quot;;<br/> echo &quot;&lt;table border=0 &gt;&quot;;<br/> $result1 = pg_query($sql);<br/> <br/> echo $stud_id;<br/> <br/> echo &quot;&lt;tr bgcolor='#FFFF33'&gt;&lt;th  &gt; |-No-| &lt;/th&gt;&lt;th&gt; |-Item Equipment-|&lt;/th&gt;&lt;th&gt;|-Series Item-| &lt;/th&gt;&lt;th&gt;|- Check-| &lt;/th&gt;&lt;/tr&gt;&quot;;<br/> while ($row = pg_fetch_array($result1))<br/>   {<br/>    $loan = ++$loan;<br/>  echo &quot;&lt;tr&gt;&quot;; <br/>        echo &quot;&lt;td bgcolor='#FFFF99' cellpadding='0' cellspacing='0'&gt;&quot; .$loan. &quot;&lt;/td&gt;&quot;;<br/>   //  echo &quot;&lt;input type='hidden' name='equ_id' id='equ_id' value='$equ_id' &gt;&quot;;<br/>     echo &quot;&lt;td bgcolor='#FFFF99' cellpadding='0' cellspacing='0'&gt;&quot;. &quot;&lt;input name='equ_name' id='equ_name' type='text' value='$row[equ_name]' readonly&gt;&quot; .&quot;&lt;/td&gt;&quot;;<br/>     echo &quot;&lt;td bgcolor='#FFFF99' cellpadding='0' cellspacing='0'&gt;&quot;. &quot;&lt;input name='equ_se_num' id='equ_se_num' size='7' type='text' value='$row[equ_se_num]' readonly &gt;&quot; .&quot;&lt;/td&gt;&quot;;<br/>     echo &quot;&lt;td bgcolor='#FFFF99' cellpadding='0' cellspacing='0'&gt;&quot;. &quot;&lt;input type='checkbox' name='check1[]' id='check1' size='7' value='yes' readonly&gt;&quot; .&quot;&lt;/td&gt;&quot;;<br/> echo  &quot;&lt;/tr&gt;&quot;;<br/>      }       <br/> echo &quot;&lt;/table&gt;&quot;;<br/> echo &quot;&lt;INPUT type='button' value='SAVE' name=button2 onclick='return OnButton2();'&gt;&quot;;<br/> echo &quot;&lt;input type='reset' name='Reset' value='RESET'&gt;&quot;;<br/> <br/> pg_free_result($result1);       <br/>  pg_close($dbh);<br/>  <br/>  require &quot;n_call&quot;;<br/>  ?&gt;<br/> <br/> //form finish//<br/> <br/> //insert query<br/> <br/> &lt;?php<br/> session_start();<br/> <br/> $stud_id = pg_escape_string($_POST['stud_id']);<br/> $loan_id = pg_escape_string($_POST['loan_id']);<br/> <br/>     $dbconn = pg_connect (&quot;host=localhost dbname=laon user=postgres password=zuraihanim&quot;);<br/>     <br/>     $loan_id =0;<br/>     <br/>     if(isset($_POST['Submit']))<br/>     {<br/>     $loan_id=$_POST['loan_id'];    <br/>     $equ_name=$_POST['equ_name'];<br/>     $equ_se_num=$_POST['equ_se_num'];<br/>     $check1=$_POST['check1'];<br/> ?&gt;    <br/>     &lt;html&gt;<br/>     &lt;style type=&quot;text/css&quot;&gt;<br/> &lt;!--<br/> .style4 {<br/>     font-family: Arial, Helvetica, sans-serif;<br/>     font-size: 12px;<br/> }<br/> --&gt;<br/> &lt;script language=&quot;Javascript1.2&quot;&gt;<br/>   &lt;!--<br/>   function printpage() {<br/>   window.print();<br/>   }<br/>   //--&gt;<br/> &lt;/script&gt;<br/> <br/>     &lt;/style&gt;<br/>  &lt;body onload=&quot;printpage()&quot;&gt;<br/>        &lt;div align=&quot;center&quot;&gt;<br/>          &lt;table width=&quot;748&quot; height=&quot;269&quot; border=&quot;0&quot; align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;<br/>         &lt;tr&gt;<br/>           &lt;td&gt;&lt;img src=&quot;images/banner1.jpg&quot; width=&quot;800&quot; height=&quot;150&quot;&gt;&lt;/td&gt;<br/>         &lt;/tr&gt;<br/>         &lt;tr&gt;<br/>           &lt;td class=&quot;style4&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span class=&quot;style4&quot;&gt;&lt;br&gt;<br/>           &lt;br&gt;<br/>  &lt;?php<br/>     <br/>     echo $stud_id;<br/>     echo &quot;&lt;table border=0 &gt;&quot;;<br/>     echo &quot;&lt;font size=12 span class='style4'&gt; &quot;.'List Equipment That You Want To Borrow'.&quot;&lt;/font&gt;&quot;.'&lt;br&gt;'.'&lt;br&gt;';<br/>     echo &quot;&lt;tr bgcolor='#FFFF33' size=12 span class='style4'&gt;&lt;th  &gt; |-No.-| &lt;/th&gt;&lt;th&gt; |-Item Equipment-|&lt;/th&gt;&lt;th&gt;|-Series Item-| &lt;/th&gt;&lt;th&gt;|- Date Borrow-| &lt;/th&gt;&lt;/tr&gt;&quot;;<br/> <br/> foreach($check1 as $cValue)<br/>     {<br/>     $sql=pg_query(&quot;INSERT INTO loan_detail(loan_id,equ_name,equ_se_num,check1) VALUES ('&quot;.$loan_id.&quot;','&quot;.$equ_name.&quot;','&quot;.$equ_se_num.&quot;','&quot;.$check1.&quot;')&quot;);        <br/>     $result=mysql_query($sql);<br/>     }<br/>     $ty++;<br/>     echo &quot;&lt;tr&gt;&quot;; <br/>     <br/>        echo &quot;&lt;td bgcolor='#FFFF99' cellpadding='0' cellspacing='0'&gt;&quot;. $ty. &quot;&lt;/td&gt;&quot;;<br/>     echo &quot;&lt;input type='hidden' name='loan_id' id='loan_id' value='loan_id'&gt;&quot;;<br/>     echo &quot;&lt;td bgcolor='#FFFF99' cellpadding='0' cellspacing='0'&gt;&quot;. &quot;&lt;input name='equ_name' id='equ_name' type='text' value='$equ_name' readonly &gt;&quot; .&quot;&lt;/td&gt;&quot;;<br/>     echo &quot;&lt;td bgcolor='#FFFF99' cellpadding='0' cellspacing='0' &gt;&quot;. &quot;&lt;input name='equ_se_num' id='equ_se_num' type='text' value='$equ_se_num' size='7' readonly &gt;&quot; .&quot;&lt;/td&gt;&quot;;<br/> <br/> echo  &quot;&lt;/tr&gt;&quot;;<br/>     <br/>     <br/>     echo &quot;&lt;/table&gt;&quot;;<br/> <br/>     echo '&lt;br&gt;';<br/>     echo '&lt;br&gt;';<br/>     echo &quot;&lt;a href='JavaScript:window.print();'&gt;Print&lt;/a&gt;&quot;;<br/> <br/>     pg_close(); <br/>      require &quot;n_call&quot;;<br/> <br/> ?&gt;<br/>               &lt;/span&gt;                        &lt;/div&gt;<br/>             &lt;p&gt;&amp;nbsp;&lt;/p&gt;<br/>           &lt;div align=&quot;center&quot;&gt;&lt;/div&gt;&lt;/td&gt;<br/>         &lt;/tr&gt;<br/>         &lt;tr&gt;<br/>           &lt;td&gt;&lt;div align=&quot;center&quot;&gt;&lt;img src=&quot;images/footer.jpg&quot; width=&quot;650&quot; height=&quot;75&quot;&gt;&lt;/div&gt;&lt;/td&gt;<br/>         &lt;/tr&gt;<br/>       &lt;/table&gt;<br/>        &lt;/div&gt;<br/>     //insert query finish..Wed, 21 Oct 2009 02:15:04 Z2009-10-28T00:10:18Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/0ef55ace-281a-43ae-ad83-00384c557afehttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/0ef55ace-281a-43ae-ad83-00384c557afeBB888http://social.msdn.microsoft.com/Profile/en-US/?user=BB888problem DateTime Select query no resultVista=32bit, W2008 R2 64bit, SQLEXPRESS 2008 SP1 64bit<br /> XAMPP 1.7.2 php 5.3<br /> PHP Driver 1.1<br /> There is a valid day in database, but it does not filter it. With SQL Management Studio SELECT is ok and returns a record, but with php there is no record<br /> Is there a language problem SETLOCALE or a config problem ?.<br /> The same code is working on a Vista machine (returns one record) , but on W2008 not (returns no record).<br /> <br /> perhaps SETLOCAL(..) ?<br /> Thank you very much.<br /> <br /> <br /> <br /> $tsql = &quot;Select * from Preise Where (Day=?) &quot;;<br /> $params = array($Day);<br /> <br /> $stmt = sqlsrv_query( $conn, $tsql, $params);<br /> if ( $stmt )<br /> {<br /> } <br /> else<br /> {<br /> &nbsp;&nbsp; echo &quot;Error in statement execution.\n&quot;;<br /> &nbsp;&nbsp; die( print_r( sqlsrv_errors(), true));<br /> }<br /> while($Row = sqlsrv_fetch_array($stmt))<br />Tue, 06 Oct 2009 20:58:12 Z2009-11-06T21:50:56Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/561cbbf6-1aec-4c27-90bf-d8b32beb7ad0http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/561cbbf6-1aec-4c27-90bf-d8b32beb7ad0ak_avengerhttp://social.msdn.microsoft.com/Profile/en-US/?user=ak_avengerSelecting "real" columns makes queries fail silentlySelecting any column of type &quot;real&quot; makes my query fail silently. This seems like a major problem to me.<br /> <br /> I posted another question earlier today, with code and explanations, but it turns out it's as simple as this. Casting to float &quot;fixes&quot; the problem, except you can't always do that (for example with stored procedures).Thu, 15 Oct 2009 20:52:08 Z2009-10-26T22:01:32Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/f79efb8d-667f-44a8-9720-a2c25b01289ahttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/f79efb8d-667f-44a8-9720-a2c25b01289aak_avengerhttp://social.msdn.microsoft.com/Profile/en-US/?user=ak_avengerWhy do some tables return rows, while others don't?Since I switched my project from the mssql_* library to the sqlsrv_* library, some tables (apparently) contain no rows when I do a SELECT on them.<br /> <br /> Both types of table (the ones that return rows and the ones that don't) are in the same database, so it's not a connection problem. My query works if I copy and paste it into SQL Server.<br /> <br /> I get no error message, no exception, nothing. Just no rows when there ARE rows in that table.<br /> <br /> Here's the code I use for getting rows from the database:<br /> <br /> <br /> ---<br /> <pre lang="x-js">class db { // ... static function query_filter($database, $query) { $connection = db::connect($database); $query_result = sqlsrv_query($connection, $query); if( $query_result === false ) { throw new db_Sql_Exception($query); } $result = array(); while( $row = sqlsrv_fetch_array($query_result) ) { $result[] = $row; } return $result; } // ... }</pre> ---<br /> <br /> <br /> And here's the test script I used to make sure I wasn't crazy:<br /> <br /> <br /> ---<br /> <pre lang="x-js">require &quot;db.php&quot;; $query = &quot; SELECT * FROM STA_LogInterfacesOperateursCompteursVitesses &quot;; $rows = db::query_filter('TestDB', $query); foreach( $rows as $row ) { print &quot;&lt;p&gt;&quot; . print_r($row) . &quot;&lt;/p&gt;&quot;; }</pre> ---<br /> <br /> <br /> If I switch the table name in my query, everything suddenly works, assuming I pick one of the tables that the SQL Server driver likes.<br /> <br /> I'm using the 1.1 / October 2009 version of the driver. I've been trying to fix this since yesterday, so any help would be appreciated.Thu, 15 Oct 2009 17:34:49 Z2009-10-26T21:59:41Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/a5d6bc01-3b93-4363-9574-5bbe8f283b89http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/a5d6bc01-3b93-4363-9574-5bbe8f283b89Z_Khttp://social.msdn.microsoft.com/Profile/en-US/?user=Z_KPHP and SQL Server Express 2008I was wondering if someone could give me a hand in getting php to work with SQL Server 2008 express.  I have PHP 5.3.0 installed and it does not have support for mssql.  I noticed on the Microsoft sight that their web installer uses 5.2.11 so I am wondering if I should remove 5.3.0 and install 5.2.11.  I tried just adding the driver, but the instructions load the dll dynamically using the php dl() function and in 5.3.0 that is not available for me to use.  Any help would be appreciated.Sat, 24 Oct 2009 00:41:52 Z2009-10-26T18:41:17Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/c3698a6b-c22d-4322-b2c8-cdac82dbf8c8http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/c3698a6b-c22d-4322-b2c8-cdac82dbf8c8Morgonhttp://social.msdn.microsoft.com/Profile/en-US/?user=MorgonSQL Server Driver for non-Windows Platforms (Round 2)Greetings SSDfP Team,<br/> <br/> Last year, I <a href="http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/7e2619a4-9335-4a31-ae18-a3640576878e">asked a question</a> regarding getting the SQL Server Driver available for other Operating Systems besides Windows. At the time, version 1.0 was in the works, and all attention was on a smooth release with current tasks. <br/> <br/> Later, I saw <a href="http://blogs.msdn.com/sqlphp/archive/2009/02/18/Working-on-version-1.1-of-the-SQL-Server-Driver-for-PHP.aspx#9576520">some discussion</a> prior to v1.1 about Unix support, and the answer was that there were some other top features that had priority.<br/> <br/> Now that v1.1 has been officially released, can you tell us your plans and/or potential timeframes (by the end of the year? Q1 2010?) to expand support to other Operating Systems? I do use SQL Server 2008 on parts of my website, and I'd really like to explore Azure (FreeTDS <a href="http://social.msdn.microsoft.com/Forums/en-US/ssdsgetstarted/thread/8e27a1d7-8a70-4084-9c19-66ed2b6a407f">has trouble</a> with it).<br/> <br/> Thanks very much for your time and dedication to bringing us official SQL Server support. :)<br/> -Jason YoungThu, 22 Oct 2009 18:35:58 Z2009-10-24T20:04:34Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/705e664b-a422-4134-879a-6e4ea3413a05http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/705e664b-a422-4134-879a-6e4ea3413a05ANT Gianthttp://social.msdn.microsoft.com/Profile/en-US/?user=ANT%20GiantPlease Provide a PDO DriverWe are using <a href="http://drupal.org">Drupal</a> one of the top three Open Source CMS systems (<a href="http://www.waterandstone.com/downloads/2008OpenSourceCMSMarketSurvey.pdf">link</a>), and would love to be able to use SQL Server.  We are not alone in this, however several community leaders have been very clear that a PDO driver is needed to make this happen.  A long discussion regarding the desire and the need for PDO is available <a href="http://drupal.org/node/74308">here</a>.  So, on behalf of the Drupal community I ask you to please provide a PDO driver.  Thank you.Thu, 30 Apr 2009 00:10:44 Z2009-10-21T12:52:54Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/7b7a6b50-bdc6-4856-a256-5bc0acf42103http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/7b7a6b50-bdc6-4856-a256-5bc0acf42103billspeghttp://social.msdn.microsoft.com/Profile/en-US/?user=billspegfatal error undefined function sql_num_rows already have 1.1 driver also added cursor by examples??????<p>I get basic queries to run but this page i am on now has multiple queries and for s&amp;g i want to make it work.<br/>i keep running across this sqlsrv_num_rows fatal error Undefined function but i can connect and run queries the code involved is below<br/>$getUser = $loginConnector-&gt;query(&quot;SELECT * FROM cmsusers WHERE user = '&quot;.$_SESSION['user'].&quot;' AND pass = '&quot;.$_SESSION['pass'].&quot;' AND thegroup &lt;= '&quot;.$group.&quot;' AND enabled = 1&quot;,array(),array(&quot;Scrollable&quot;=&gt;SQLSRV_CURSOR_KEYSET));</p> <p>   if ($loginConnector-&gt;getNumRows($getUser) &gt; 0){<br/>    // Existing user ok, continue<br/>    if ($goodRedirect != '') { <br/>     header(&quot;Location: &quot;.$goodRedirect.&quot;?&quot;.strip_tags(session_id())) ;<br/>    }   <br/>    return true;<br/>   }else{<br/>    // Existing user not ok, logout<br/>    $this-&gt;logout();<br/>    return false;<br/>   }<br/><br/>getNumRows() is from an include DbConnector Class the function follows<br/><br/>function getNumRows($result){<br/> return sqlsvr_num_rows($result);<br/>}</p>Sat, 17 Oct 2009 05:09:02 Z2009-10-21T14:42:41Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/28b9a53a-eaee-493b-9c68-49c3c38e1d71http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/28b9a53a-eaee-493b-9c68-49c3c38e1d71dipanchokshihttp://social.msdn.microsoft.com/Profile/en-US/?user=dipanchokshimssql connectivity with php5Hi everyone<br /> i am developing website in php5 with database mssql.<br /> i am new with mssql<br /> When i am trying to connect with mssql i am getting this error.<br /> <br /> <br /> Warning: mssql_connect() [function.mssql-connect]: message: Login failed for user 'NT <br /> <br /> AUTHORITY\ANONYMOUS LOGON'. (severity 14) in C:\wamp\www\nimspl\conn\config.php on line 23<br /> <br /> Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: VBSERVER\MSSQL in <br /> <br /> C:\wamp\www\nimspl\conn\config.php on line 23<br /> Could not connect to SQL Server on VBSERVER\MSSQL Login failed for user 'NT AUTHORITY\ANONYMOUS <br /> <br /> LOGON'.<br /> <br /> &nbsp;I am using MSSQL server 2005.<br /> Using Microsoft SQL Server Mgt. Studio Express i am able to connect database with Authentication : <br /> <br /> SQL Server Authentication<br /> <br /> I have enable in php<br /> <br /> 1. extension=php_mssql.dll in php.ini file.<br /> 2. mssql.allow_persistent = On<br /> 3. mssql.secure_connection = On<br /> <br /> Moreover i have download latest file &quot;ntwdblib.dll&quot; and kept in my php folder.<br /> <br /> Now pls guide me for this.<br /> I am stuck in this.<br /> <br /> Thanks<br /> <br /> <br />Fri, 09 Oct 2009 11:49:50 Z2009-10-20T12:01:17Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/aed95679-2281-4b8d-8798-288372d68b05http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/aed95679-2281-4b8d-8798-288372d68b05Nilestahttp://social.msdn.microsoft.com/Profile/en-US/?user=NilestaSQLSRV is undefined only when one file calls it, works fine elsewhereSQLSRV is installed. &nbsp;I know it's installed because only one php file is giving this error. &nbsp;Every other file on the server is working fine, using the same commands. <div><br /></div> <div>The set up:</div> <div>home.php uses sqlsrv to check the database for sections the user can access and display files in each section. &nbsp;That page works fine.</div> <div><br /></div> <div>When you click on one of the files, getfile.php, which is stored in the same folder as home.php, first connects to the database without issue, and then crashes on sqlsrv_fetch_array, with the above error message.</div> <div><br /></div> <div>The code originally, was:</div> <div> <pre>$Query = "SELECT * FROM Sections WHERE ID='" . $_GET['s'] . "'"; $Section = sqlsrv_fetch_array(sqlsrv_query($DB, $Query));</pre> <div>home.php runs a while on the array fetching, so on it, the code is:</div> <div><br /></div> <div> <pre>$Query = "SELECT * FROM Sections"; $Sections = sqlsrv_query($DB, $Query); $JID = 1; while ($Section = sqlsrv_fetch_array($Sections)){</pre> So I tried changing the code on getfile.php to:</div> <div><br /></div> <div> <pre>$Query = "SELECT * FROM Sections WHERE ID='" . $_GET['s'] . "'"; $Temp = sqlsrv_query($DB, $Query); $Section = sqlsrv_fetch_array($Temp);</pre> <div><br /></div> </div> <div>And that still errors out:</div> <div><br /></div> <div><span style="font-family: 'Times New Roman'; font-size: medium;"><strong>Fatal error</strong>: Call to undefined function sqlsrv_query() in&nbsp;<strong>[Path]\getfile.php</strong>&nbsp;on line&nbsp;<strong>31</strong></span></div> <div><span style="font-family: 'Times New Roman', Arial, Helvetica, sans-serif;"><span style="font-size: medium;"><br /></span></span></div> <div><span style="font-family: 'Times New Roman', Arial, Helvetica, sans-serif;"><span style="font-size: medium;">Keep in mind, before telling me sqlsrv is undefined, it uses it to connect to the database without any problems, and uses the exact same code in a file in the same folder without any problems.</span></span></div> </div> <br /> <div>I've tried restarting IIS with no luck.</div>Tue, 13 Oct 2009 19:31:14 Z2009-10-22T14:00:26Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/ce73b229-497a-443a-a420-3fa2601ac590http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/ce73b229-497a-443a-a420-3fa2601ac590LordGhttp://social.msdn.microsoft.com/Profile/en-US/?user=LordGWhy can't a output variable be set to null?Hi,<br/> <br/> Why is this &quot;Variables that are initialized or updated to <strong>null</strong> , <strong>DateTime</strong> , or stream types cannot be used as output parameters.&quot; not possible? In particular, <strong>updated to null.</strong> <br/>Thu, 24 Sep 2009 21:27:29 Z2009-10-13T14:31:13Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/a7ae7d01-9c8d-424b-8768-b725a49a1fdbhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/a7ae7d01-9c8d-424b-8768-b725a49a1fdbcharliestrausehttp://social.msdn.microsoft.com/Profile/en-US/?user=charliestrauseMemory usage by May CTP<p align=left><font face=Arial size=2></font> </p> <p>Using the same test as before, Apache httpd doesn't seem to grow without bound any more. That's good. This is with a standard Apache and PHP5 combination. Thread safe version of the driver.</p> <p align=left> </p> <p align=left>When I run the non-thread safe version on a computer that uses the Zend framework, then the php-cgi.exe program has its memory use growing. I don't think that's good since that's our production environment.</p>Wed, 04 Jun 2008 20:18:20 Z2009-10-10T18:51:59Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/125fc411-82d5-47f1-9b40-7ff8d00e040bhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/125fc411-82d5-47f1-9b40-7ff8d00e040bDreamDevilhttp://social.msdn.microsoft.com/Profile/en-US/?user=DreamDevilDeadlock problem with TEXT/NTEXT/VARCHAR(MAX)/NVARCHAR(MAX)<p>Hi, we ran into a situation where a single process deadlock itself indefinitely.  The situation is:</p> <ul> <li>Try to update the currently fetched record </li> <li>WHEN the SELECT query has an ORDER BY clause</li> <li>AND the resultset contains a minimum of records</li> <li>AND an CLOB (TEXT/VARCHAR(MAX)) column is part of the resultset</li> </ul> <p>Basically, the scenario is a batch processing job that act like that:</p> <ul> <li>SELECT all records from Table WHERE record has to be processed ORDER BY priority</li> <li>FOR EACH RECORD <ul> <li>Process record</li> <li>Mark record as processed (UPDATE table SET processed = 1 where id = ...)</li> </ul> </li> </ul> <p>Notes:</p> <ul> <li>There is no explicit &quot;begin transactions&quot;</li> <li>we always use the same connection reference</li> </ul> <p>Here is all the steps to reproduce the problem in a controled environment:</p> <ul> <li>Create a test table using this script:<br/> <pre lang=x-sql>CREATE TABLE [dbo].[channel] ( [id] [int] NOT NULL, [title] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [description] [VARCHAR](MAX) COLLATE Latin1_General_CS_AS NULL, [rank] [int] NULL, [mustGenerate] [bit] NULL, CONSTRAINT [PK_channel] PRIMARY KEY CLUSTERED ([id] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY]</pre> </li> <li>Create a PHP script (ex: sqlsrv_test.php) that will accept a &quot;step&quot; parameter as HTTP GET</li> <li>Paste the following code:<br/> <pre lang="x-c#">function getConnection() { //TODO: ENTER YOUR DATABASE CONNECTION INFORMATION HERE $serverName = &quot;xxx.xxx.xxx.xxx&quot;; $connectionInfos = array('Database' =&gt; 'SQLPHP', 'UID' =&gt; 'user', 'PWD' =&gt; 'password'); $conn = sqlsrv_connect($serverName, $connectionInfos); return ($conn); } function fillDatabase($conn, $startId, $endId) { $sql = &quot;INSERT INTO channel (id, title, description, rank, mustGenerate) VALUES (?, ?, ?, ?, ?)&quot;; for ($id = $startId; $id &lt;= $endId; $id++) { $params = array($id, 'title ' . $id, 'description ' . $id, $id * 10, 1); sqlsrv_query($conn, $sql, $params); } echo &quot;Database filled with IDs from $startId to $endId&lt;br/&gt;&quot;; } function testQueryLock($conn) { $query = &quot;SELECT * FROM channel ORDER BY rank ASC&quot;; $stmt = sqlsrv_query($conn, $query); $count = 0; $row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC); while (false !== $row) { $count++; $id = $row['id']; if (!empty($id)) { echo $id; //NOTE: THIS IS THE UPDATE THAT WILL EVENTUALLY END-UP CREATING A DEADLOCK $update = &quot;UPDATE channel SET mustGenerate = 0 WHERE id = $id&quot;; $updateResult = sqlsrv_query($conn, $update); if ($updateResult) echo &quot; - ok &lt;br/&gt;&quot;; else echo &quot; = FAILED &lt;br/&gt;&quot;; } $row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC); } echo &quot;count = $count&quot;; sqlsrv_free_stmt($stmt); } //--------------------------------------------------------------- if ('1' == $_GET['step']) { $conn = getConnection(); fillDatabase($conn, 1, 200); sqlsrv_close($conn); } //--------------------------------------------------------------- if ('2' == $_GET['step']) { $conn = getConnection(); testQueryLock($conn); sqlsrv_close($conn); echo &quot;Success, not enough record in resultset to generate the problem!&quot;; } //--------------------------------------------------------------- if ('3' == $_GET['step']) { $conn = getConnection(); fillDatabase($conn, 201, 500); sqlsrv_close($conn); } //--------------------------------------------------------------- if ('4' == $_GET['step']) { $conn = getConnection(); testQueryLock($conn); sqlsrv_close($conn); echo &quot;This will never get echoed!&quot;; } </pre> </li> </ul> <p>To run the test just navigate each step:</p> <ul> <li>http://localhost/sqlsrv_test.php?step=1<br/>=&gt; database filled with 200 records</li> <li>http://localhost/sqlsrv_test.php?step=2<br/>=&gt; success </li> <li>http://localhost/sqlsrv_test.php?step=3<br/>=&gt; database filled with additional records</li> <li>http://localhost/sqlsrv_test.php?step=4<br/>=&gt; script is never ending. Deadlock in driver.</li> </ul> <p>Now if you remove the &quot;ORDER BY rank ASC&quot; in the testQueryLock function and repeat step 4 you will see the string &quot;This will never get echoed!&quot; being echoed.</p> <p>Again, (put back the &quot;ORDER BY rank ASC&quot; if you removed it) and run this and execute step 1 to 4, that will still work:</p> <pre lang=x-sql>DELETE FROM channel ALTER TABLE channel ALTER COLUMN description VARCHAR(250)</pre> <p>I did test with TEXT, NTEXT, VARCHAR(MAX), NVARCHAR(MAX) and all these types end-up creating the deadlock situation.</p> <p>Running Environment:</p> <ul> <li>Windows XP Professional</li> <li>ZendCore 2.5.2 (PHP 5.2.6, Zend Engine 2.2.0, Apache 2.2.10)</li> <li>SQLSRV 1.0.1924</li> </ul> I remember getting this problem with a Wamp Installation over Windows XP and using SQLSRV 1.0.1307Tue, 16 Jun 2009 13:44:18 Z2009-10-10T00:52:04Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/4742bea6-6887-4fed-8170-9e08e4802c71http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/4742bea6-6887-4fed-8170-9e08e4802c71tjmoorehttp://social.msdn.microsoft.com/Profile/en-US/?user=tjmooreerror when calling stored procedure<p><br /><br />Trying to test this with ID "42", but I get errors. Stored Procedure works at command line if I type: <br /><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"><font size="2" color="#0000ff"><font size="2" color="#0000ff"> <p>exec</p> </font></font></span><font size="2" color="#0000ff"> <p>&nbsp;</p> </font></span></p> <p><span style="font-size: x-small;"> usp_matchalgorithm</span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"> </span></span><span style="font-size: x-small;">42<font size="2"> <p>&nbsp;</p> </font></span></p> <p><br /><br />$sqlTypePro = "EXECUTE dbo.usp_matchalgorithm ?";</p> <p>$params = array(&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; array(42, SQLSRV_PARAM_IN)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />$stmt = sqlsrv_query($conn, $sqlTypePro, $params);</p> <p>if( $stmt === false )&nbsp; {&nbsp; <br />&nbsp;&nbsp;&nbsp; die( "&lt;pre&gt;".print_r(sqlsrv_errors(), true)."&lt;/pre&gt;" ); <br />} else {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; $data = sqlsrv_fetch_array($stmt);<br />&nbsp;&nbsp;&nbsp; var_dump($data);<br />}&nbsp; <br /><br />ERRORS:<br /></p> <pre>Array ( [0] =&gt; Array ( [0] =&gt; 01000 [SQLSTATE] =&gt; 01000 [1] =&gt; 0 [code] =&gt; 0 [2] =&gt; [Microsoft][SQL Native Client][SQL Server]5 [message] =&gt; [Microsoft][SQL Native Client][SQL Server]5 ) [1] =&gt; Array ( [0] =&gt; 01000 [SQLSTATE] =&gt; 01000 [1] =&gt; 0 [code] =&gt; 0 [2] =&gt; [Microsoft][SQL Native Client][SQL Server]0 [message] =&gt; [Microsoft][SQL Native Client][SQL Server]0 ) ) </pre>Mon, 05 Oct 2009 20:51:37 Z2009-10-23T04:09:56Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/85eb2015-f7c5-4b23-bc94-b6255a3a908chttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/85eb2015-f7c5-4b23-bc94-b6255a3a908cLordGhttp://social.msdn.microsoft.com/Profile/en-US/?user=LordGStored Procedure Insert adds junk to varchar outputHi SQLSRV Support!<br/> <br/> We found another problem and isolated it into a test case. The problem is that if a stored procedure does an insert into a table, and sets a varchar output param, that param will have added junk on it to fill it to a length of 100 - varchar(100). In the end, we traced this down to one missing line in the Stored Proc... SET NOCOUNT ON, once that was in, the output varchars did not get filled.<br/> <br/> <strong>PHP Code:</strong> <br/> <br/> <pre> //connect $options = array( 'UID' =&gt; 'xxx', 'PWD' =&gt; 'xxx', 'Database' =&gt; 'Test DB' ); $host = '127.0.0.1,1433'; $conn = sqlsrv_connect($host, $options); if ($conn) { echo &quot;Connected to $host\n&quot;; } else { echo &quot;Not Connected $host\n&quot;; echo print_r(sqlsrv_errors(), true).&quot;\n&quot;; } //Execute a stored procedure $sql = &quot;{call TestSqlSrv(?,?,?)}&quot;; $variables = array( 'Result' =&gt; '', 'LastID' =&gt; 0, ); $params = array( array(&amp;$variables['Result'], SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY), SQLSRV_SQLTYPE_VARCHAR(100)), array(&amp;$variables['LastID'], SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT, SQLSRV_SQLTYPE_INT), ); //display before variables echo &quot;SP Variables Defined.\n&quot; . print_r($variables, true).&quot;\n&quot;; //run query $stmt = sqlsrv_query($conn, $sql, $params); if ($stmt) { echo &quot;Query executed: $sql\n&quot;; } else { echo &quot;Query failed\n&quot; . print_r(sqlsrv_errors(), true).&quot;\n&quot;; } //clear any results do { $next = sqlsrv_next_result($stmt); } while ($next); //clean up sqlsrv_free_stmt($stmt); sqlsrv_close($conn); //print the variables echo &quot;SP Variables Returned.\n&quot; . print_r($variables, true).&quot;\n&quot;;</pre> <br/> <strong>SQL TABLE:</strong> <br/> <br/> <pre lang=x-sql>USE [Test DB] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[Temp]( [ID] [int] IDENTITY(1,1) NOT NULL, [Name] [varchar](100) NOT NULL, [Data] [varchar](1000) NOT NULL ) ON [PRIMARY] GO SET ANSI_PADDING OFF</pre> <br/> <strong>SQL PROCEDURE:</strong> <br/> <br/> <pre lang=x-sql>USE [Test DB] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[TestSqlSrv] @Result varchar(100) OUTPUT, @LastID int OUTPUT AS SET NOCOUNT ON --added as was causing the junk fill problem! BEGIN INSERT INTO dbo.Temp ([Name],[Data]) VALUES (N'test name',N'test data') SET @LastID = SCOPE_IDENTITY() SET @Result = '1' END</pre> <br/> If you comment out the line SET NOCOUNT ON, then the @Result output will come out 100% correctly. Why???<br/> <br/> G<br/> <br/> <br/>  Tue, 29 Sep 2009 09:35:38 Z2009-10-07T17:55:37Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/9961d3eb-4633-447f-906f-a582884834b5http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/9961d3eb-4633-447f-906f-a582884834b5LordGhttp://social.msdn.microsoft.com/Profile/en-US/?user=LordGINOUT paramter not working, what is wrong?Hi,<br/> <br/> We are testing the sqlsrv with stored procedures and inout paramters. However, we keep getting the error &quot;String data, right truncation&quot;.<br/> <br/> Stored Procedure:<br/> <pre lang=x-sql>ALTER PROCEDURE [dbo].[TestSqlSrv] @In varchar(100), @Out varchar(100) OUTPUT, @InOut varchar(100) OUTPUT AS SET NOCOUNT ON BEGIN SET @Out = @InOut; SET @InOut = 'abc'; RETURN END</pre> Then the php code/variables are:<br/> <pre> $sql = &quot;{call TestSqlSrv(?,?,?)}&quot;; $variables = array( 'In' =&gt; 'one', 'Out' =&gt; '', 'InOut' =&gt; 'two' ); $params = array( array( &amp;$variables['In'], SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_VARCHAR(100) ), array( &amp;$variables['Out'], SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_VARCHAR(100) ), array( &amp;$variables['InOut'], SQLSRV_PARAM_INOUT, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_VARCHAR(100) ) ); </pre> Can anyone put some light on this problem?<br/> <br/> Thanks,<br/> G.Thu, 24 Sep 2009 15:04:13 Z2009-10-07T17:55:03Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/c16cd108-66f2-447e-ba11-3429b902f033http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/c16cd108-66f2-447e-ba11-3429b902f033n00b0101http://social.msdn.microsoft.com/Profile/en-US/?user=n00b0101Desperate for help connecting to MSSQL from PHP<p align=left><font face=Arial size=2>I'm completely new and unfamiliar with mssql, so I'm going to try and describe every little thing here to see if I missed something along the way... At the very end of this file (below the code), I've included the mssql settings from my php.ini file and also some of the sql server 2008 properties that I thought might be relevant.<br><br>I have xampp installed on my computer, it has the mssql driver and PEAR::MDB2 installed. extension=php_mssql.dll is uncommented in my php.ini file, as is extension=php_pdo_mssql.dll. <br><br>I have Microsoft SQL Server 2008 installed on my computer. I've launched the application (does that mean that the server is running when I do that?), and the username is jadmin and it uses Windows Authentication to connect.<br><br>Below is the code that I'm trying to use. I've tried using LPTP, MSSQLSERVER, [ipnumber],1433, [ipnumber].1433, and 127.0.0.1(1434) for the hostname, but no matter what happens, I get MDB2 Error: connect failed. <br><br>Please help! This is my first time doing this and I have *no* idea how to use mssql<br><br>Also, here's what I get when I do netstat -an, in case it's relevant:<br>Microsoft Windows XP [Version 5.1.2600]<br>(C) Copyright 1985-2001 Microsoft Corp.<br><br>Active Connections<br><br>Proto Local Address Foreign Address State<br>TCP 0.0.0.0:80 0.0.0.0:0 LISTENING<br>TCP 0.0.0.0:135 0.0.0.0:0 LISTENING<br>TCP 0.0.0.0:443 0.0.0.0:0 LISTENING<br>TCP 0.0.0.0:445 0.0.0.0:0 LISTENING<br>TCP 0.0.0.0:2383 0.0.0.0:0 LISTENING<br>TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING<br>TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING<br>TCP 127.0.0.1:80 127.0.0.1:1977 TIME_WAIT<br>TCP 127.0.0.1:80 127.0.0.1:1981 TIME_WAIT<br>TCP 127.0.0.1:1028 0.0.0.0:0 LISTENING<br>TCP 127.0.0.1:1434 0.0.0.0:0 LISTENING<br></font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face="Courier New"> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div><font face="Courier New">&lt;?php<br>   require_once('MDB2.php');<br><br>   class Database<br>   {<br>      private   $_s_username   = '';<br>      private   $_s_password   = '';<br>      private   $_s_database   = '';<br>      private   $_s_server      = '';<br>      private $_s_type      = '';<br>      private $_r_connection   = null;<br><br>      public function __construct($username = null, $password = null, $database = null, $server = null, $type = null)<br>      {<br>         try<br>         {<br>            if ((strlen($username) == 0)<br>               || (strlen($password) == 0)<br>               || (strlen($database) == 0)<br>               || (strlen($server) == 0))<br>            {<br>               $this-&gt;_s_username = 'jadmin';<br>               $this-&gt;_s_password = '';<br>               $this-&gt;_s_database = 'testdb';<br>               $this-&gt;_s_server = 'LPTP';<br>            }<br>            else<br>            {<br>               $this-&gt;_s_username = $username;<br>               $this-&gt;_s_password = $password;<br>               $this-&gt;_s_database = $database;<br>               $this-&gt;_s_server = $server;<br>            }<br>            if (strlen($type) == 0) {$this-&gt;_s_type = 'mssql';}<br>            else {$this-&gt;_s_type = $type;}<br>         }<br>         catch(exception $error)<br>         {<br>print($error-&gt;getMessage());<br>         }<br>      }<br>      <br>      public function __destruct()<br>      {<br>         $this-&gt;_r_connection-&gt;disconnect();<br>      }<br>      <br>      private function connect()<br>      {<br>         try<br>         {<br>            $dsn = $this-&gt;_s_type . '://' . $this-&gt;_s_username . ':' . $this-&gt;_s_password . '@' . $this-&gt;_s_server . '/' . $this-&gt;_s_database;<br>            $db = MDB2::connect($dsn);<br>            if (PEAR::isError($db)) {throw new Exception($db-&gt;getMessage());}<br>            else<br>            {<br>               $this-&gt;_r_connection = $db;<br>               return true;<br>            }<br>         }<br>         catch(exception $error)<br>         {<br>print($error-&gt;getMessage());<br>            return false;<br>         }<br>      }<br>      <br>      private function disconnect()<br>      {<br>         $this-&gt;_r_connection-&gt;disconnect();<br>      }<br>      <br>      public function query($querystring)<br>      {<br>         $r_recordset = null;<br>         <br>         try<br>         {<br>            $this-&gt;connect();<br>            $r_recordset = $this-&gt;_r_connection-&gt;query($querystring);<br>            if (PEAR::isError($r_recordset)) {throw new Exception($r_recordset-&gt;getMessage());}<br>            <br>            return $r_recordset;<br>         }<br>         catch (Exception $error)<br>         {<br>print($error-&gt;getMessage());<br>            return false;<br>         }<br>         $this-&gt;disconnect();<br>      }<br>      <br>      public function execute($query_string)<br>      {<br>         $r_result = null;<br>         $db = null;<br>         try<br>         {<br>            $this-&gt;connect();<br>            $db = $this-&gt;_r_connection;<br>print('&lt;br&gt;&lt;br&gt;');<br>var_dump($db);<br>print('|');<br>var_dump($this-&gt;_r_connection);<br>print('&lt;br&gt;&lt;br&gt;');<br>            $r_result = $db-&gt;execute($querystring);<br>            if (PEAR::isError($r_result)) {throw new Exception($r_result-&gt;getMessage());}<br>            <br>            return $r_result;<br>         }<br>         catch (Exception $error)<br>         {<br>print(&quot;&lt;br&gt;|&quot; . $error-&gt;getMessage() . &quot;|&quot;);<br>            return false;<br>         }<br>         $this-&gt;disconnect();<br>      }<br>   }<br>   <br>   $db = new Database;<br>?&gt;</font><br> <p align=left> </p></div></div> <p align=left> </p></font> <p></p> <p align=left><font face=Arial size=2> </p></font> <p align=left> </p> <p align=left> </p> <p align=left> </p> <p>From my php.ini file<br>-------------------------------------------<br>[MSSQL]<br>; Allow or prevent persistent links.<br>mssql.allow_persistent = On</p> <p>; Maximum number of persistent links.  -1 means no limit.<br>mssql.max_persistent = -1</p> <p>; Maximum number of links (persistent+non persistent).  -1 means no limit.<br>mssql.max_links = -1</p> <p>; Minimum error severity to display.<br>mssql.min_error_severity = 10</p> <p>; Minimum message severity to display.<br>mssql.min_message_severity = 10</p> <p>; Compatability mode with old versions of PHP 3.0.<br>mssql.compatability_mode = Off</p> <p>; Connect timeout<br>;mssql.connect_timeout = 5</p> <p>; Query timeout<br>;mssql.timeout = 60</p> <p>; Valid range 0 - 2147483647.  Default = 4096.<br>;mssql.textlimit = 4096</p> <p>; Valid range 0 - 2147483647.  Default = 4096.<br>;mssql.textsize = 4096</p> <p>; Limits the number of records in each batch.  0 = all records in one batch.<br>;mssql.batchsize = 0</p> <p>; Specify how datetime and datetim4 columns are returned<br>; On =&gt; Returns data converted to SQL server settings<br>; Off =&gt; Returns values as YYYY-MM-DD hh:mm<img height=19 alt="Tongue Tied" src="http://forums.microsoft.com/MSDN/emoticons/emotion-7.gif" width=19>s<br>;mssql.datetimeconvert = On</p> <p>; Use NT authentication when connecting to the server<br>mssql.secure_connection = Off</p> <p>; Specify max number of processes. -1 = library default<br>; msdlib defaults to 25<br>; FreeTDS defaults to 4096<br>;mssql.max_procs = -1</p> <p><br>SQL SERVER SERVICES<br>Taken from Sql Server Configuration<br>-------------------------------------------<br>Name State Start Mode Log On As Process ID Service Type<br>SQL Server Integration Services 10.0 Running Automatic NT AUTHORITY\NETWORK SERVICE 1072 SSIS Server<br>SQL Full-text Filter Daemon Launcher (MSSQLSERVER) Running Manual NT AUTHORITY\LOCAL SERVICE 3708 Full-text Filter Daemon Launcher<br>SQL Server (MSSQLSERVER) Running Automatic NT AUTHORITY\NETWORK SERVICE 1584 SQL Server<br>SQL Server Analysis Services (MSSQLSERVER) Running Automatic NT AUTHORITY\NETWORK SERVICE 1532 Analysis Server<br>SQL Server Reporting Services (MSSQLSERVER) Running Automatic NT AUTHORITY\NETWORK SERVICE 1220 ReportServer<br>SQL Server Browser Stopped Other (Boot, System, Disabled or Unknown) NT AUTHORITY\LOCAL SERVICE 0 SQL Browser<br>SQL Server Agent (MSSQLSERVER) Running Manual NT AUTHORITY\NETWORK SERVICE 4712 SQL Agent</p> <p>SQL SERVER NETWORK CONFIGURATION<br>Taken from Sql Server Configuration<br>------------------------------------------<br>Protocol Name Status<br>Shared Memory Enabled<br>Named Pipes Disabled<br>TCP/IP Enabled<br>VIA Disabled</p> <p>SQL NATIVE CLIENT 10.0 CONFIGURATION<br>Taken from Sql Server Configuration<br>-------------------------------------------<br>Name Order Enabled<br>Shared Memory 1 Enabled<br>TCP/IP 2 Enabled<br>Named Pipes 3 Enabled<br>VIA  Disabled</p> <p><br>SERVER PROPERTIES<br>This is taken from &quot;Server Properties&quot; from Microsoft SQL Server Management Studio<br>--------------------------------------------------------------------------------------<br>Name   LPTP<br>Product   Microsoft SQL Server Enterprise Edition <br>Operating System Microsoft Windows NT 5.1 (2600)<br>Platform  NT INTEL x86<br>Version   10.0.1600.22<br>Language  English (United States)<br>Memory   1271 MB<br>Processors  1<br>Root Directory  C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL<br>Server Collation SQL_Latin1_General_CP1_CI_AS<br>Is Clustered  FALSE</p>Mon, 08 Dec 2008 16:34:51 Z2009-10-06T14:44:34Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/64be651d-7b73-4a78-ba4e-81e9363103echttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/64be651d-7b73-4a78-ba4e-81e9363103ecmaartenba01http://social.msdn.microsoft.com/Profile/en-US/?user=maartenba01Driver 1.1 CTP and SQL Azure<p>When trying to connect to SQL Azure using the following code, I get &quot;Unable to connect&quot;. No further warnings or errors:<br/><br/>$connectionInfo = array( &quot;UID&quot;=&gt;'xxxxxxxxx',<br/>                         &quot;PWD&quot;=&gt;'yyyyyyyyyyy',<br/>                         &quot;Database&quot;=&gt;&quot;wordpress&quot;);</p> <p>$conn = sqlsrv_connect('tcp:xxxxxxxxx.ctp.database.windows.net', $connectionInfo);</p> <p>if( $conn === false )<br/>{<br/>     echo &quot;Unable to connect.&lt;/br&gt;&quot;;<br/>     die( print_r( sqlsrv_errors(), true));<br/>}<br/><br/>I'm using the latest SQL2008 native client on my machine.</p>Tue, 18 Aug 2009 21:02:04 Z2009-10-03T01:53:54Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/716fd6f5-741b-4a9b-a237-f07cd2c02cadhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/716fd6f5-741b-4a9b-a237-f07cd2c02cadbradfultonhttp://social.msdn.microsoft.com/Profile/en-US/?user=bradfultonSQL Azure and PHP on AzureI have a test PHP program working on Azure, except that I can't connect to my SQL Azure database.  For some reason the sqlsrv extension isn't active.  I was previously trying to use the thread-safe version, but have switched to the non-thread-safe versions of both PHP and the SQL Server extension driver.  <br/><br/>The program works using the &quot;local cloud&quot;, connecting to the SQL Azure database remotely, it just doesn't work when I upload it to Azure.<br/><br/>Currently I have a page that displays phpinfo and it doesn't show SQLSRV.  I also have some code that checks for the extension being active, and it does die, indicating that the extension isn't active.  Here's the code:<br/><span style="color:#808080;font-size:x-small"><span style="color:#808080;font-size:x-small"> <p>if (!extension_loaded(&quot;sqlsrv&quot;))</p> <p>{</p> <p>die(&quot;sqlsrv extension not loaded&quot;);</p> <p>}<br/><br/>I've put the following lines in php.ini:<br/><span style="font-size:x-small"> <p>[PHP_SQLSRV]</p> <p>extension=php_sqlsrv_53_nts_vc9.dll<br/><br/>and php.ini is marked as &quot;content&quot; and &quot;always copy&quot;<br/><br/>the php_sqlsrv_53_nts_vc9.dll file is included in the PHP\ext subdirectory and is marked as 'content' and 'copy always'</p> </span></p> </span></span>Tue, 29 Sep 2009 19:19:23 Z2009-10-21T21:25:58Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/a5474018-0dd5-4329-be50-d5dc67168166http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/a5474018-0dd5-4329-be50-d5dc67168166OakBehringerhttp://social.msdn.microsoft.com/Profile/en-US/?user=OakBehringerMONEY column showing .0000 for value 0... Used to be 0.00, kindaExecute this in SQL Server Management Tools:<br/> <br/> <pre>select CAST(0 as money) as dollars;</pre> <br/> You will get 0.00 as a result. This is also what you receive with the php/mssl_* functions. <br/> <br/> With the SQL Server Driver for PHP you get .0000<br/> <br/> This is annoying. Anything I can do about it? <br/> <br/> I am using v1.1 of the driver w/SQLSERVER2008. This affects the display of what is returned in hundreds of stored procedures. <br/> <br/> Use this code to see it in php:<br/> <pre>$conn = sqlsrv_connect(...); $result = sqlsrv_query($conn, 'select CAST(0 as money) dollars;'); while($ar = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) { print_r($ar); }</pre>Wed, 23 Sep 2009 20:09:03 Z2009-09-24T19:25:23Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/ed015bfa-6b8f-40d7-b286-7d4fc9d070bchttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/ed015bfa-6b8f-40d7-b286-7d4fc9d070bcTravis Paxtonhttp://social.msdn.microsoft.com/Profile/en-US/?user=Travis%20PaxtonInconsistent performance of driver vs Management Studio queriesI'm using PHP 5.3 (non-thread safe, FastCGI, IIS7, Server 2008) and the latest PHP Driver for SQL Server (1.1 CTP, non-thread safe, VC9).  I'm seeing a major performance issues with executing stored procedures from PHP vs. from the Management Studio.  The queries in PHP are timing out after 5 minutes and never return a result set whereas when the queries are ran from the Management Studio, they return in less than 1 second.  The result set is only 25 rows by 4 columns in size.  Has anyone else seen any related scenarios or have any suggestions?  Thanks!Wed, 23 Sep 2009 20:28:42 Z2009-10-23T04:09:26Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/1b6c7fec-ecc5-4391-a397-cc810485fae4http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/1b6c7fec-ecc5-4391-a397-cc810485fae4LordGhttp://social.msdn.microsoft.com/Profile/en-US/?user=LordGDo you have to use streams?Is is imperritive that say a Text type field returned in a resultset must be retrieved as a stream?<br/> <br/> For example, with the following code:<br/> <br/> <pre> public function fetchResults($free) { if ($this-&gt;hasResults()) { $results = array(); $row = sqlsrv_fetch_array($this-&gt;query, SQLSRV_FETCH_ASSOC); if ($row) { do { $results[] = $row; $row = sqlsrv_fetch_array($this-&gt;query, SQLSRV_FETCH_ASSOC); } while($row); } if ($free) { sqlsrv_free_stmt($this-&gt;query); } return $results; } else { return false; } }</pre> Will this retrieve any stream field types?<br/> <br/> GTue, 22 Sep 2009 13:37:40 Z2009-09-23T07:57:03Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/55268c68-9d37-4b0f-ad0e-4213bad1d182http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/55268c68-9d37-4b0f-ad0e-4213bad1d182RaulAngelhttp://social.msdn.microsoft.com/Profile/en-US/?user=RaulAngelphp_mssql compiled for PHP 5.3 - windows_xp anybody can provide me the php_mssql.dll for PHP 5.3 for Windows xp ?<br/> the date of the php_mssql.dll that i have is 22/01/2004 and give this error<br/> when i try to connect: Unable to load dynamic llibrary c: \PHP\ext\php_mssql.dl,<br/> ins't a win32 application. <br/> <br/> I don't know C++ to compile from source<br/> <br/> Thanks very much.Tue, 22 Sep 2009 19:03:38 Z2009-10-23T04:09:03Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/3d61d841-1cf1-4f3c-b53b-4edeaee24a06http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/3d61d841-1cf1-4f3c-b53b-4edeaee24a06LordGhttp://social.msdn.microsoft.com/Profile/en-US/?user=LordGundefined SQLSRV_PHPTYPE_INTEGERHi Guys,<br/> <br/> Tried searching online for this, but can't find anything.<br/> <br/> The SQLSRV_PHPTYPE_INTEGER constant specified in the documentation does not exist. I believe they actually meant SQLSRV_PHPTYPE_INT. Just incase anyone else gets the undefined error.<br/> <br/> Hopefully the documentation gets updated.<br/> <br/> G<br/>Tue, 22 Sep 2009 13:23:28 Z2009-09-22T20:20:22Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/950e4444-3ad4-4a05-8e45-dfc45c4d9a22http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/950e4444-3ad4-4a05-8e45-dfc45c4d9a22RaulAngelhttp://social.msdn.microsoft.com/Profile/en-US/?user=RaulAngelconnecting SQL SERVER 2005 via Sql Server Driver for PHP 1.1is this an impossible mission ?  -or- does nobody use the Windows-Apache-PHP-Mssql with Sql server driver environmet?<br/> <br/> - I have this platform: Windows XP, Apache 2.2, PHP 5.3, Sql Native Client 2008, Sql server driver 1.1 (Abri/2009)<br/> - In PhpInfo() the sqlsrv is active<br/> - I've all the configurations:<br/>     Sql server manager:   protocol TCP/IP enable<br/>                               named pipe enable enable, name pipe: \\.\pipe\MSSQL$SQLEXPRESS\sql\query<br/>                   IPall: TCP Dynamic port = null<br/>                   TCP port: 1433<br/>     Client Protocols  :   Client protocol: TCP/IP enable<br/>                               named pipe enable enable, name pipe: \\.\pipe\MSSQL$SQLEXPRESS\sql\query<br/>                   Aliases: Invitado, Protocol TCP/IP, Port 1433, server RAUL\SQLEXPRESS<br/> <br/>     Sql Surface Area Configuration: service MSSQL$SQLEXPRESS is running<br/>                     Remote connections: local and remote connections, using both<br/>                                 TCP/IP and named pipes<br/> <br/> - In PHP script i've tried all the alternatives:<br/>     - $serverName = &quot;.\SQLEXPRESS&quot;;<br/>       $serverName = &quot;RAUL\SQLEXPRESS&quot;;<br/>       $serverName = &quot;RAUL,1433&quot;;<br/>         - $UID    = &quot;raul&quot;;<br/>           $PWD    = &quot;asdfe12&quot;;<br/>           $UID    = &quot;&quot;;<br/>           $PWD    = &quot;&quot;;<br/>         - $connectionOptions = array(&quot;Database&quot;=&gt;&quot;Contable&quot;, &quot;UID&quot; =&gt; $UID, &quot;PWD&quot; =&gt; $PWD);<br/>           $connectionOptions = array(&quot;Database&quot;=&gt;&quot;Contable.mdf&quot;, &quot;UID&quot; =&gt; $UID, &quot;PWD&quot; =&gt; $PWD);<br/>           $connectionOptions = array(&quot;Database&quot;=&gt;&quot;C:\Sistemas\Contables\Contable&quot;);<br/>           $connectionOptions = array(&quot;Database&quot;=&gt;&quot;Contable&quot;);<br/>     - $conn = sqlsrv_connect( $serverName, $connectionOptions);<br/>       $conn = sqlsrv_connect( $serverName);<br/> <br/>   but allways i have the same error: &quot;Connection could not be established&quot;<br/> <br/> - In addition i've included the trace options: &quot;TraceOn&quot; =&gt; true, 'TraceFile' =&gt; 'C:/sqlsrv_trace.txt'<br/>     <br/> <br/>   any help?. Thank for your answer<br/>Sun, 20 Sep 2009 15:41:26 Z2009-10-23T04:08:27Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/972b872f-dc14-4e59-8427-1d666553d807http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/972b872f-dc14-4e59-8427-1d666553d807landon1http://social.msdn.microsoft.com/Profile/en-US/?user=landon1sqlsrv_connect no connecting with or without windows authenticationfinally getting somewhere<br/>I discovered that I needed to do the rest of the install for fast cgi 1.5 in the following link:<a href="http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60"><br/>http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60</a><br/><br/>PHP 5.3  <br/>using: php-5.3.0-Win32-VC9-x86.zip and <br/>SQL SERVER DRIVER : php_sqlsrv_53_ts_vc9.dll<br/><br/>neither of the following work:<br/>SQL Server 2008 error<br/>error: Login failed for user 'LANDON\IWAM_LANDON'. Reason: Failed to open the explicitly specified database. [CLIENT: &lt;local machine&gt;]<br/><br/>also failed: <a href="http://209.33.25.167:8080/phpinfo.php">http://209.33.25.167:8080/phpinfo.php</a><br/>error:<br/> <table border=0 cellspacing=0 cellpadding=0 width=730> <tbody> <tr> <td rowspan=2 width=60 align=left valign=top> </td> <td width="*" align=left valign=middle> <h1>The website cannot display the page</h1> </td> </tr> <tr> <td class=errorCodeAndDivider align=right> HTTP 500</td> </tr> <tr> <td> </td> <td align=left valign=top> <h3>Most likely causes:</h3> </td> </tr> </tbody> </table> <br/><br/>maybe I should check the permissions for IWAM_LANDON as I did IUSR_LANDON<br/><br/>I checked and that was NOT the problem.<br/><br/>I have diddled everything in php.ini until my keyboard is worn out.<br/>I downloaded and installed IIS 6 and it is running with 5.1 stopped.<br/><br/>Yes remote connection allowed in 2008<br/>I can connect to the 2008 database via server management studio using windows authentication<br/> <pre>&lt;?php /* Connect to the local server using Windows Authentication and specify the AdventureWorks database as the database in use. To connect using SQL Server Authentication, set values for the &quot;UID&quot; and &quot;PWD&quot; attributes in the $connectionInfo parameter. For example: */ //$connectionInfo = array(&quot;UID&quot; =&gt; &quot;sa&quot;, &quot;PWD&quot; =&gt; &quot;01234&quot;); $serverName = &quot;LANDON\SQLEXPRESSLMK&quot;; $connectionInfo = array( &quot;Database&quot;=&gt;&quot;logbookid&quot;); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo &quot;Connection established.\n&quot;; sqlsrv_close( $conn); } else { echo &quot;Connection could not be established.\n&quot;; //die( print_r( sqlsrv_errors(), true)); } //----------------------------------------------- // Perform operations with connection. //----------------------------------------------- /* Close the connection. */ //sqlsrv_close( $conn); ?&gt; _____________________________________<br/><pre>&lt;?php /* Connect to the local server NOT using Windows Authentication and specify the AdventureWorks database as the database in use. To connect using SQL Server Authentication, set values for the &quot;UID&quot; and &quot;PWD&quot; attributes in the $connectionInfo parameter. For example: */ $connectionInfo = array(&quot;UID&quot; =&gt; &quot;sa&quot;, &quot;PWD&quot; =&gt; &quot;01234&quot;); $serverName = &quot;LANDON\SQLEXPRESSLMK&quot;; $connectionInfo = array( &quot;Database&quot;=&gt;&quot;logbookid&quot;); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo &quot;Connection established.\n&quot;; sqlsrv_close( $conn); } else { echo &quot;Connection could not be established.\n&quot;; //die( print_r( sqlsrv_errors(), true)); } //----------------------------------------------- // Perform operations with connection. //----------------------------------------------- /* Close the connection. */ //sqlsrv_close( $conn); ?&gt; </pre> ; Directory in which the loadable extensions (modules) reside.<br/>; <a href="http://php.net/extension-dir">http://php.net/extension-dir</a><br/>; extension_dir = &quot;./&quot;<br/>;extension_dir = &quot;C:\PHP\ext&quot;<br/>; On windows:<br/>extension_dir = &quot;ext&quot;</pre> <pre>; cgi.force_redirect is necessary to provide security running PHP as a CGI under<br/>; most web servers.  Left undefined, PHP turns this on by default.  You can<br/>; turn it off here AT YOUR OWN RISK<br/>; **You CAN safely turn this off for IIS, in fact, you MUST.**<br/>; <a href="http://php.net/cgi.force-redirect">http://php.net/cgi.force-redirect</a><br/>cgi.force_redirect = 0<br/></pre> <pre>; Directory in which the loadable extensions (modules) reside. ; http://php.net/extension-dir ; extension_dir = &quot;./&quot; ;extension_dir = &quot;C:\PHP\ext&quot; this is the way it was before 5.3 ; On windows: extension_dir = &quot;ext&quot; ; The root of the PHP pages, used only if nonempty. ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root ; if you are running php as a CGI under any web server (other than IIS) ; see documentation for security issues. The alternate is to use the ; cgi.force_redirect configuration below ; http://php.net/doc-root doc_root = &quot;C:\Inetpub\wwwroot&quot;<br/></pre>Thu, 10 Sep 2009 22:15:34 Z2009-09-19T02:27:52Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/595b62d5-d26d-4667-b5a0-33f12a66be2ehttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/595b62d5-d26d-4667-b5a0-33f12a66be2eDr.Frodohttp://social.msdn.microsoft.com/Profile/en-US/?user=Dr.FrodoConverting from PHPLib mssql classHi, I am using the old mssql class from PHPLib. I hoped I could just replace old mssql-functions with new sqlsrv-functions, but it was not so easy.<br/> Eg. in the old dblib connection I use is not the first record available after a query is performed, which it is in the new driver<br/> Have anyone already done this convertion? Is there a framework out there which has implemented SQLServerDriverForPHP?Wed, 09 Sep 2009 09:54:50 Z2009-10-21T14:44:42Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/ab13d9df-9a6c-4033-96e4-8288829fe4bfhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/ab13d9df-9a6c-4033-96e4-8288829fe4bfBuchkahttp://social.msdn.microsoft.com/Profile/en-US/?user=Buchkax64 supportCurrently source codes do not compile for x64 platform. Is there any plans for x64 version?Fri, 18 Sep 2009 12:29:17 Z2009-09-22T20:20:55Zhttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/a672fb74-6759-46d5-92e6-9a2e8d44c29chttp://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/a672fb74-6759-46d5-92e6-9a2e8d44c29clandon1http://social.msdn.microsoft.com/Profile/en-US/?user=landon1files downloaded for SQL Server Driver for PHP 1.1 same as the files for SQL Server Driver for PHP 1.0http://www.microsoft.com/downloads/thankyou.aspx?familyId=ccdf728b-1ea0-48a8-a84a-5052214caad9&amp;displayLang=en<br/> <br/> 'ReturnDatesAsStrings'=&gt;true included in connection string works with 1.1<br/> the following didn't work with the addition of 'ReturnDatesAsStrings'=&gt;true<br/> <br/> $connectionInfo = array(&quot;Database&quot;=&gt;&quot;logbookid&quot;, &quot;UID&quot; =&gt; &quot;sa&quot;, &quot;PWD&quot; =&gt; &quot;01234&quot;,<br/>         'ReturnDatesAsStrings'=&gt;true);<br/> <br/> http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/42503986-b14b-4301-b142-96f8275ebc7a<br/> <br/> Yes:<br/> (1) I restarted IIS5.1<br/> (2) copied the new (?) file into C:\PHP\ext<br/> <br/> Maybe it didn't like PHP 5.2.6<br/> <br/> <br/> I did it twice so I was sure I was making no mistake! BUT! I must have!<br/>Thu, 17 Sep 2009 20:16:46 Z2009-09-18T14:09:24Z