Solved

PHP 4.4 with MsSQL on IIS 7

Posted on 2013-06-25
4
1,026 Views
Last Modified: 2013-07-01
I have a new IIS 7 installation and need to run PHP 4.x with the older MsSQL extension temporarily. The extension must support the mssql_connect function.
How can I accomplish this?
0
Comment
Question by:DataDudes
  • 2
4 Comments
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
If it's your server or computer, just set up a site, download a copy of PHP and install it.  Note that 'mssql' works up thru PHP 5.2.  You don't 'have' to go back to PHP 4 unless something else in your code requires it.  PHP 4.4.9, the last PHP 4 version, is available here: http://museum.php.net/php4/php-4.4.9-Win32.zip
0
 
LVL 9

Expert Comment

by:tanujchandna
Comment Utility
Hi,

If mssql_connect is not working for you then configure SQLSrv in PHP using the following url:

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

Open read me (available under this download url) to see how to configure it in php.ini file.

After configuring the extension in php.ini use the following connection string to connect with MSSQL

<?php
$serverName = "xx.xx.xx.xx"; //serverName\instanceName, portNumber (default is 1433)
$connectionInfo = array( "Database"=>"aadharinstitute", "UID"=>"aadharinstitute", "PWD"=>"java.net");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}
?>
0
 
LVL 2

Author Comment

by:DataDudes
Comment Utility
I can't change it to sqlsrv_connect because that would require a full rewrite of the entire codebase. There has to be an easier way to do this.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
PHP 5.2.17 will use the 'mssql' driver and it's still available too.  It's not supported starting with PHP 5.3 on Windows.  And no, there does not have to be an easier way to do this.  And if you keep this app on the web on Windows servers, you will eventually have to rewrite your code.  

The reason for the change is that the old 'mssql' driver has not be supported or updated for many years.  Microsoft wrote their own driver as much to keep people from switching to MySQL as any other reason.  You may notice that 'mssql' is still supported on Linux.  Don't be fooled, it's not really the same driver.  It has the same apparent syntax but 'under the hood', it's different and pretty limited.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article discusses four methods for overlaying images in a container on a web page
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now