none
PHP 5.4.5 on Win 2008 R2 and SQL Server 2000

    Question

  • Hi,

    We are planning to move quite a bit system (about 700K lines) working on PHP 5.1.6 with Frank Kromann php_dblib.dll on Win 2000 and SQL 2000 to Win 2008 R2. Later planning to switch DB from 2000 to 2005 or 2008 (will depend on a client). Frank's dll saved us from buggy ntwdblib.dll used by PHP MSSQL driver back in 2005-2006.

    My question is - PHP 5.4.5 on Win 2008 R2 and SQL Server 2000.

    Will it work with SQLSRV 3.0? Will it work at all? If it is not stable please suggest what PHP, MS PHP driver combo would be the best.

    Thank you

    Igor


    -- Partner at Deep Shift Labs. We are building Nerrvana - Selenium cloud at your fingertips and Startyco - pluggable web apps for start-ups.

    Friday, August 10, 2012 1:21 PM

Answers

All replies

  • Fortunately this forum helped me to raise and answer all the questions myself :)

    "SQL Server Native Client 11.0 does not support connections to SQL Server 2000"

    Not sure why 11.0 as install showed this:

    Which is clearly 2012 Native Client. Strange, very strange....

    So it looks like this driver can not be used to work with SQL 2000. If anyone has any suggestions - please post here.


    -- Partner at Deep Shift Labs. We are building Nerrvana - Selenium cloud at your fingertips and Startyco - pluggable web apps for start-ups.

    Saturday, August 11, 2012 2:42 PM
  • Hi Igor,

    Thanks for sharing this.

    Yes, SQL Server Native Client 11.0 only supports SQL Server 2005 and later version. For this scenario, you can consider to use early version of Native Client. Here is a link for download the SQL Server 2008 native client (10.0):

    http://www.microsoft.com/en-us/download/details.aspx?id=16177

    SQL Server 2012 Native Client is Native Client 11.0, for more information, you can see this link:

    http://msdn.microsoft.com/en-us/library/cc280356.aspx

    By the way, SQL Server 2000 is no longer supported, suggest you to upgrade your SQL Server for better experience.

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Best Regards,
    Iric
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, August 13, 2012 7:45 AM
    Moderator
  • For this scenario, you can consider to use early version of Native Client. Here is a link for download the SQL Server 2008 native client (10.0):

    http://www.microsoft.com/en-us/download/details.aspx?id=1617


    Will this version work with SQL 2000? I know SQL 2000 is very outdated but it is client's decision. We ate going to move IIS to Server 2008R2 and database to SQL 2008 but I wanted to avoid doing it at the same time.

    On the other side can you confirm that "early version of Native Client" is not buggy? Do you know anyone personally running this version in  a past in a production environment?

    Thank you

    -- Partner at Deep Shift Labs. We are building Nerrvana - Selenium cloud at your fingertips and Startyco - pluggable web apps for start-ups.


    Monday, August 13, 2012 9:09 AM
  • Igor,

    From the first website I posted, you can find:

    Microsoft SQL Server 2008 Native Client (SQL Native Client) is a single dynamic-link library (DLL) containing both the SQL OLE DB provider and SQL ODBC driver. It contains run-time support for applications using native-code APIs (ODBC, OLE DB and ADO) to connect to Microsoft SQL Server 2000, 2005, or 2008. SQL Native Client should be used to create new applications or enhance existing applications that need to take advantage of new SQL Server 2008 features. This redistributable installer for SQL Native Client installs the client components needed during run time to take advantage of new SQL Server 2008 features, and optionally installs the header files needed to develop an application that uses the SQL Native Client API.

    So it is supported to connect to SQL Server 2000 by using SQL Server 2008 Native Client(10.0).

    For the second question, it is not buggy,

    SQL Server Native Client 11.0 supports connections to SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, and SQL Server 2012.

    You can find this on the second website I posted.

    As I mentioned that SQL Server 2000 is no longer supported, most of the new features or drivers may not compatible with 2000.


    Best Regards,
    Iric
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, August 13, 2012 9:49 AM
    Moderator
  • PHP MS installer installed SQL server 2008 Native client (see my picture above)

    PHP returns:

    "SQL Server Native Client 11.0 does not support connections to SQL Server 2000"

    Is it corrrect that "SQL server 2008 Native client" contains "SQL Server Native Client 11.0"? Probably it is just. Looks like your company named them to confuse :)


    -- Partner at Deep Shift Labs. We are building Nerrvana - Selenium cloud at your fingertips and Startyco - pluggable web apps for start-ups.

    Monday, August 13, 2012 10:09 AM
  • Native Client 11.0 == SQL 2012

    PHP sqlsrv driver version 3.0 uses Native Client 11.0, so the error you are getting is because you are using driver version 3.0.  You need to change this in php.ini.

    PHP sqlsrv driver 2.0 uses Native Client 10.  Your SQL 2000 customer needs driver version 2.0 with Native Client 2008 R2.  These points will interest you about driver version 2.0:

    1. it has a memory leak, fixed in v.3.0, details here: http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/7e419559-0d8f-4cea-a2ae-28b71a800f63.
    2. it behaves differently with DateTime values on SQL Server 2000/2005 compared to 2008.  You will only get the expected results if your PHP code works purely in UTC dates and times, details here in my final 2 comments: http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/46f399b2-49b1-47cb-a1ff-97b44788e571

    Rob

    Monday, August 13, 2012 4:37 PM
  • Additionally, the SQL Server 2012 (11.0) driver will not explicitly block connections to SQL Server 2000, but we simply don't test it and don't support it any more. :)

    This posting is provided 'AS IS' with no warranties, and confers no rights.

    Monday, August 13, 2012 5:41 PM
  • Additionally, the SQL Server 2012 (11.0) driver will not explicitly block connections to SQL Server 2000, but we simply don't test it and don't support it any more. :)

    This posting is provided 'AS IS' with no warranties, and confers no rights.


    From post above I understood that SQL Server 2012 (11.0) driver will NOT connect to SQL 2000 at all

    -- Partner at Deep Shift Labs. We are building Nerrvana - Selenium cloud at your fingertips and Startyco - pluggable web apps for start-ups.

    Tuesday, August 14, 2012 2:07 AM
  • Native Client 11.0 == SQL 2012

    PHP sqlsrv driver version 3.0 uses Native Client 11.0, so the error you are getting is because you are using driver version 3.0.  You need to change this in php.ini.

    PHP sqlsrv driver 2.0 uses Native Client 10.  Your SQL 2000 customer needs driver version 2.0 with Native Client 2008 R2.  These points will interest you about driver version 2.0:

    1. it has a memory leak, fixed in v.3.0, details here: http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/7e419559-0d8f-4cea-a2ae-28b71a800f63.
    2. it behaves differently with DateTime values on SQL Server 2000/2005 compared to 2008.  You will only get the expected results if your PHP code works purely in UTC dates and times, details here in my final 2 comments: http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/46f399b2-49b1-47cb-a1ff-97b44788e571

    Rob

    Thank you Robert. This is handy. Yes we do not use time offsets but point 1 is pretty scary to me.

    So when Iric said "it is not buggy" about Native Client 2008 (ver. 10) it was true. But there are some problems in actual PHP driver v 2 which is the only driver yet supporting SQL 2000.Correct?

    I would say we will have to upgrade both IIS/PHP and database in this case. Have no intention to become "memory leak" jedi.

    The only thing left is my other topic - http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/0e023a13-aac2-4114-a8ac-178e54427f39

    The only way I managed to install PHP properly (can see php.ini) on 2008 R2 is with MS PHP installer. After install I managed to add PHP 4.5.4 into IIS management console. But with manual install:

    1. PHP in C:\PHP

    2. PHP driver is in C:\PHP\ext

    3. php.ini in C:\PHP and SQL extensions are added

    4. IIS configured with FAST CGI. PHPRC in Fast CGI points to C:\PHP

    5. Native client is installed

    I can see pnpinfo() page but it states that php.ini location izs in C:\Windows and loaded php.ini is none. So obviously SQL extensions are not loaded and error log is not getting created in C:\tmp as specified in php.ini

    May be you can tell why PHP can not see a new location of php.ini? My understanding that PHPRC variable is supposed to tell PHP where is php.ini location.

    Since we are not going to connect to SQL 2000 now I can keep my auto install with http://php.iis.net/ but I am just curious. If you have any ideas please post in there.

    Thank you again,

    Igor


    -- Partner at Deep Shift Labs. We are building Nerrvana - Selenium cloud at your fingertips and Startyco - pluggable web apps for start-ups.

    Tuesday, August 14, 2012 2:31 AM
  • Could you please try installing PHP using the Web Platform Installer? This will automatically install PHP and the PHP driver for you, as well as giving you a handy PHP Manager in IIS Manager.

    http://www.microsoft.com/web/platform/

    It looks like you were doing this originally, but if that were the case, PHP would not be installed in c:\PHP :)

    Thanks,


    Jonathan

    This posting is provided 'AS IS' with no warranties, and confers no rights.


    Tuesday, August 14, 2012 3:02 AM
  • I wrote that I managed to install it with Web installer but I also managed to add another PHP version via IIS PHP consolde - PHP 4.5.4 which is located in C:\PHP.

    So all is fine with installer. I have PHP console in IIS and I can use it to change between original PHP installed by installer PHP 5.3.13 and 5.4.5 I put into C:\PHP. You probably now that PHP IIS console allows to add multiple PHP versions. It is all works. Both PHP versions use own php.ini files etc. I just do not know how you do the magic of switching fast cgi mappings when I switch PHP version in IIS PHP console as both PHP5313_mapping and PHP454_mapping are looking to handle  *.php extension and they are both enabled when for example I enable PHP 5.4.5 inside a console. Can you shed some light here? IIS PHP console allows to add another PHP version and it creates handlers automatically for FastCGI but how IIS manages to call a correct php-cgi.exe if both handlers are enabled all the time. One is located in C:php\php-cgi.exe for PHP 4.5.4 and another one under C:\Program Files where installer puts 5.3.13.

    It is all cool by me if it works properly but having Unix sysadmin background I always try to understand how it works and this is why my post above where I was wondering what could be wrong with my manual install.

    At least logically I want to understand:

    - how IIS PHP console manages handlers when more than one PHP version used

    -what is wrong with PHP manual install. I followed instructions but PHP can not see php.ini file.

    Cheers,

    Igor


    -- Partner at Deep Shift Labs. We are building Nerrvana - Selenium cloud at your fingertips and Startyco - pluggable web apps for start-ups.

    Tuesday, August 14, 2012 3:26 AM
  • OK, let me see if I can get someone on the thread to help you with this. Configuration PHP like this is outside of my expertise. :)

    Cheers,


    Jonathan

    This posting is provided 'AS IS' with no warranties, and confers no rights.


    Tuesday, August 14, 2012 4:21 AM
  • >OK, let me see if I can get someone on the thread to help you with this. Configuration PHP like this is outside of my expertise. :)

    Thanks so much Jonathan.


    -- Partner at Deep Shift Labs. We are building Nerrvana - Selenium cloud at your fingertips and Startyco - pluggable web apps for start-ups.

    Tuesday, August 14, 2012 4:26 AM
  • Hi Igor

    PHP accepts a command line parameter to choose a specific php.ini file, that can be anywhere on your computer, e.g.:

    • php.exe -c "C:\My Folder\website.ini"

      or for fast CGI:
    • php-cgi.exe -c "C:\My Folder\website.ini"

    You can configure FastCGI for IIS 6 and 7 differently, Microsoft's Ruslan Y has a lot of help on this on the excellent IIS.NET web site:

    1. EDIT... Go here first: http://learn.iis.net/page.aspx/745/enable-per-site-php-configuration-on-iis-60-and-iis-7-and-above/
    2. FastCGI on IIS 7: http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis/
    3. FastCGI on IIS 6: http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/

    The links above will tell you where you can add the '-c' argument to php-cgi.exe, see the 'per-site configuration' sections.


    Rob

    • Edited by Robert Johnson Tuesday, August 14, 2012 9:11 AM Found a better help link
    • Marked as answer by Jonathan Guerin Tuesday, August 14, 2012 6:53 PM
    Tuesday, August 14, 2012 9:02 AM
  • Saw Ruslan's article but did not pay attention (as usual). Now see it. So I guess PHP IIS console allows to change PHP version IIS wise and replaces a pool every time you change PHP version for all sites globally. This way it can have 20 mappings for *.php and only one will be used. I think it only does it for *.php. If you also want to handle many PHP versions but also handle *.html with PHP IIS PHP console will not work.

    I guess it is not possible until PHP console analyses all mappings where php-cgi.exe involved. When I was adding PHP 4.5.4 I already had *html processing with PHP added for 5.3 but after PHP 4.5.4 was added I only saw a new PHP454 handler created in IIS for *.php extension. So if I would add *.html and switch PHP versions inside a console it will have a wrong association for HTML (will process it with wrong PHP version)

    Even though I am not planning to run different versions PHP side by side I still think it needs to be configured manually in a way Ruslan explains it. May be if you want to install and run one PHP version (do not use different PHP versions switch from PHP IIS Console) it is fine to use as it installs all components and have these nice controls for php.ini settings.

    Thanks a lot for pointing me to these links.


    -- Partner at Deep Shift Labs. We are building Nerrvana - Selenium cloud at your fingertips and Startyco - pluggable web apps for start-ups.

    Tuesday, August 14, 2012 9:34 AM
  • Thank you guys. I take my words "Fortunately this forum helped me to raise and answer all the questions myself :)" BACK.

    -- Partner at Deep Shift Labs. We are building Nerrvana - Selenium cloud at your fingertips and Startyco - pluggable web apps for start-ups.

    Wednesday, August 15, 2012 1:46 AM