Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1103
  • Last Modified:

PHP 4.4 with MsSQL on IIS 7

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
OAC Technology
Asked:
OAC Technology
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
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
 
tanujchandnaCommented:
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
 
OAC TechnologyProfessional NerdsAuthor Commented:
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
 
Dave BaldwinFixer of ProblemsCommented:
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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now