jjmac Posted August 17, 2010 Share Posted August 17, 2010 I have many web applications I've written over the years currently on a Windows 2003 server running IIS6 and PHP4. Our SQL server is a Microsoft SQL server 2008. PHP4 came with mssql module, all I had to do back then was uncomment the mssql section of php.ini and it was good to go. The old server is still up and running and functioning, but I'm trying to set up a new server with PHP5 and move all of the web applications over to it. I'm a bit confused as to which version of PHP I should install, whether VC6 or VC9, thread safe or non-thread safe and whether I should install it as CGI or Fast-CGI module. I did eventually get PHP installed. However PHP5 does not come bundled with MS SQL. After some searching I found a Microsoft SQL driver for PHP. However the syntax is class based, and all of my old code is function based. I was able to get this to work with the database, however there is a LOT of code I would have to change in order to move the applications over. TLDR: Is there a way to install PHP5 on IIS with a module that uses the old mssql functions (as opposed to the class based driver issued by Microsoft) to interact with MS SQL Server 2008 so that I can simply copy my applications over instead of having to rewrite all of the code that interacts with the database? - Wasn't sure if this should go in MS SQL or Installation forums, please move if necessary. Quote Link to comment https://forums.phpfreaks.com/topic/211004-moving-web-applications-to-a-new-server-need-help-installing/ Share on other sites More sharing options...
Brian Swan Posted August 17, 2010 Share Posted August 17, 2010 jjmac- If you are moving to PHP5, I would suggest that you bite the bullet (as tough as it might be) and move to the sqlsrv driver (the SQL Server Driver for PHP). The old mssql driver is based on obsolete dblib technology (more about that here: http://blogs.msdn.com/b/brian_swan/archive/2010/03/08/mssql-vs-sqlsrv-what-s-the-difference-part-1.aspx). The good news is that the 2.0 release of the sqlsrv driver comes in two flavors: the SQLSRV driver (which is a "function-based" or "procedural" driver) and the PDO_SQLSRV driver (which supports PDO and is object-oriented). So, you shouldn't have to make the jump to using classes if you don't want to. The bad news is that there isn't an easy way (that I know of) to install PHP 5 with support for the old php_mssql.dll driver. Hopefully, this blog post will help convert to the sqlsrv driver: http://blogs.msdn.com/b/brian_swan/archive/2010/03/10/mssql-vs-sqlsrv-what-s-the-difference-part-2.aspx. On the question of CGI vs. Fast-CGI, definitely go with Fast-CGI (the CGI module spins up a new PHP process for every incoming request!). Performance with Fast-CGI is much better. One easy way to get this all set up is to use the Web Platform Installer (installs PHP, sqlsrv driver, SQL Server Express, etc...and configures everything). Check it out here: http://www.microsoft.com/web/downloads/platform.aspx. One drawback of the WPI is that it installs PHP 5.2.14, not PHP 5.3 (which has tons of Windows optimizations). The question of VC6 vs VC9 only comes into play (I think) if you are running PHP 5.3...in which case you should go for VC9. If you want to go with PHP 5.3, you'll have to install/configure it manually: http://php.net/manual/pl/install.windows.iis7.php. I hope that helps. Let me know if you have more questions. -Brian Quote Link to comment https://forums.phpfreaks.com/topic/211004-moving-web-applications-to-a-new-server-need-help-installing/#findComment-1100529 Share on other sites More sharing options...
jjmac Posted August 18, 2010 Author Share Posted August 18, 2010 Thanks so much, very valuable information for me. I do a lot of web application development, but not much on the server and installation side of things so I really appreciate the information! WPI looks to be something I'll be very interested in, even if it doesn't have PHP 5.3. I have a question about WPI, do you know if they release updates? For instance at some point will I be able to update to 5.3 via WPI? Quote Link to comment https://forums.phpfreaks.com/topic/211004-moving-web-applications-to-a-new-server-need-help-installing/#findComment-1100704 Share on other sites More sharing options...
Brian Swan Posted August 18, 2010 Share Posted August 18, 2010 Yes, WPI is updated often. I know that are plans to add PHP 5.3 as an option soon, but I don't have any dates. Glad the information was helpful. -Brian Quote Link to comment https://forums.phpfreaks.com/topic/211004-moving-web-applications-to-a-new-server-need-help-installing/#findComment-1100771 Share on other sites More sharing options...
jjmac Posted August 18, 2010 Author Share Posted August 18, 2010 I tried out Microsoft Web Platform Installer and it worked great. Started playing around with the sqlsrv functions and it looks like it's not going to be that bad to convert my old apps to use this driver -- Not as bad as converting them to class based anyway. Find and replace will take care of most of it it looks like, aside from the db connections. Thanks again for the help! Quote Link to comment https://forums.phpfreaks.com/topic/211004-moving-web-applications-to-a-new-server-need-help-installing/#findComment-1100897 Share on other sites More sharing options...
jjmac Posted August 19, 2010 Author Share Posted August 19, 2010 I came across a comment on the PHP web site under documentation for mssql_connect today that addressed my specific problem exactly: If you have an application which requires MSSQL as interface (and not the new SQLSRV) you have to look for an alternative method. The old (now rightly unsupported) way from Microsoft does not work with PHP 5.3. After spending several days and nights with trying to connect here is an easy solution which worked great with all applicatins expecting mssql: FreeTDS for Windows. Here is a great how to with installer links on the Moodle site: http://docs.moodle.org/en/Installing_MSSQL_for_PHP Couple of hints: - Make sure you have set up a user with "SQL SERVER authentication" who has rights to connect. - Also make sure after you install and still have problems to run PHPinfo and check that you find the below: PHPINFO: mssql MSSQL Support enabled ... Library version FreeTDS That works perfect for me on Windows 2003 with IIS6 and PHP 5.3 (non threadsafe, VC9). Hope this is helpful I followed the instructions on http://docs.moodle.org/en/Installing_MSSQL_for_PHP to install php_dblib.dll, copied one of my apps over to the new server and it ran exactly as expected with no change to the code. Quote Link to comment https://forums.phpfreaks.com/topic/211004-moving-web-applications-to-a-new-server-need-help-installing/#findComment-1101403 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.