Mssql not loaded

Good day!

I try a lot of configuration to work my connection from php to mssql but still I cannot connect. And I got a code to check if the mssql was loaded.

Here is the code:


<?php
if (function_exists('mssql_connect')){
echo "Okay, fn is there<br>------------------<br>";
} else {
echo "Hmmm .. fn is not even there<br>------------------<br>";
}

if(extension_loaded("mssql")) {
echo "MSSQL is Loaded<br>";
}
else {
echo "MSSQL not loaded<br>";
} 

if(extension_loaded("msql")) {
echo "MSQL is Loaded<br>";
}
else {
echo "MSQL not loaded<br>";
} 
echo '<br><br>';

$ext = get_loaded_extensions();
if(in_array('mssql', $ext))
echo 'u have mssql installed<br><br>';
else
echo 'u do NOT have mssql installed<br><br>';

phpinfo();
?>

And when I run this code the result is:

Hmmm….fn is not even there

MSSQL not loaded
MSQL not loaded
You do NOT have mssql installed
And the list of phpinfo() appear.

Actually I run this code when my php version is php 5.2.4 and now I try it to php 5.1.4 and the result is still the same.

Web server is IIS 6.0
OS is Windows Server 2003 R2 Standard Edition
PHP version is php 5.1.4
MS SQL Server 2005 Express Edition –Windows Authentication.

I need to solved this problem because my connection in mssql is not working because call to undefined the function mssql_connect().

I hope somebody can help me. Almost three weeks I configure this connection and still I cannot connect.

Any help is highly appreciated.
Thank you.

I face same type of problem.How it will solve?

You need to have the mssql extension installed and enabled.

Again, as I recommended to someone else, do not use the legacy database access functions (mssql, mysql, odbc, etc.) unless you face a huge amount of conversion time on existing code. Use the PDO library instead - it’s faster, abstracts much of the detail work and most importantly makes database changes trivial.

http://www.php.net/PDO

Second, if you change php.ini you must restart Apache for the changes to take effect.

I resolved my problem by moving php.ini from C:\php tp C:\WINDOWS

PHP mssql sql extensions are dead and obsolete , use sql server extensions provided by microsoft for php they support both normal functionality and with pdo ,
tested and works with sql server 2000 - sql server 2008 R2
http://sqlsrvphp.codeplex.com/ (you may also need to install sql server 2008 extension pack)

I don’t think using PDO will immediately help here, as it is just another layer on top of the drivers.

And yes - Restart the server after making changes to php.ini. If it still doesn’t work, look in the web servers error-logs.

What did you mean I need to insrtall the mssql.dll?How?
I already enabled mssql.dll in my php.ini
But when I run my phpinfo() I noticed that all the changes I do in my php.ini did not take effect in my phpinfo() and also the Configuration File(php.ini) Path is in C:\WINDOWS but my php.ini is in my C:\php and also the extension_dir in my phpinfo() is in C:\php5 but I configure my php.ini and my extension_dir in my php.ini is in C:\php\ext