Page 1 of 1

Odd combo

Posted: Mon Jul 17, 2006 1:45 pm
by ratan
I am using PHP, IIS, SQLServer 2005 on windows. I am trying to configure PHP 5 for SQL Server. I am getting this error:
Fatal error: Call to undefined function mssql_connect() in c:\Inetpub\wwwroot...

I have made the following changes to php.ini:
extension=php_mssql.dll,
extension_dir = "c:\php" ,
cgi.force_redirect = 0

I have also uncommented extension=php_mysql.dll and that works fine to connect to mysql db.

Any help/guidance is appreciated...Thanks.

Posted: Mon Jul 17, 2006 1:56 pm
by RobertGonzalez
Is the mssql.dll file in your extension dir?

Posted: Mon Jul 17, 2006 2:42 pm
by ratan
yeah it is php5 so it is part of the ext directory

Posted: Mon Jul 17, 2006 3:30 pm
by RobertGonzalez
Make a php info page and see what extensions are loaded.

Code: Select all

<?php
phpinfo();
?>

Posted: Mon Jul 17, 2006 3:46 pm
by feyd
better yet run the following in a new file and tell us the results please.

Code: Select all

<?php

$neg = array(0, false, '', null, 'off');
$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
$rg = (in_array(strtolower(ini_get('register_globals')), $neg) ? 'Off' : 'On');
$de = (in_array(strtolower(ini_get('display_errors')), $neg) ? 'Off' : 'On');
$so = (in_array(strtolower(ini_get('short_open_tag')), $neg) ? 'Off' : 'On');
$le = '';
$cli = (php_sapi_name() == 'cli');
$eol = ($cli ? "\n" : "<br />\n");

$gle = get_loaded_extensions();
$rows = array();
$wide = 4;
$j = count($gle);
$pad = $wide - $j % $wide;
$len = max(array_map('strlen', $gle));
$func = create_function('$a', 'return str_pad($a, ' . intval($len) . ');');
$gle = array_map($func, $gle);
for($i = 0; $i < $j; $i += $wide)
{
    $le .= '   ' . implode('   ', array_slice($gle, $i, $wide)) . "\n";
}
if ($cli)
{
     $le = $eol . $le;
}
else
{
 $le = '<pre>' . $le . '</pre>';
}

$ec = array(
   'E_STRICT' => 2048, 'E_ALL' => 2047, 'E_USER_NOTICE' => 1024,
   'E_USER_WARNING' => 512, 'E_USER_ERROR' => 256, 'E_COMPILE_WARNING' => 128,
   'E_COMPILE_ERROR' => 64, 'E_CORE_WARNING' => 32, 'E_CORE_ERROR' => 16,
   'E_NOTICE' => 8, 'E_PARSE' => 4, 'E_WARNING' => 2, 'E_ERROR' => 1,
);

$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
   if (($t & $v) == $v)
   {
      $e[] = $n;
      $t ^= $v;
   }
}
$er = $er . ' (' . implode(' | ', $e) . ')';

if (!$cli)
{
  echo '<html><head><title>quick info</title></head><body>' . "\n";
}

echo 'PHP Version: ' . $ve . $eol;
echo 'PHP OS: ' . $os . $eol;
echo 'Error Reporting: ' . $er . $eol;
echo 'Register Globals: ' . $rg . $eol;
echo 'Short Tags: ' . $so . $eol;
echo 'Display Errors: ' . $de . $eol;
echo 'Loaded Extensions:' . $le . $eol;

if (!$cli)
{
  echo '</body></html>' . "\n";
}

?>

Posted: Mon Jul 17, 2006 3:58 pm
by ratan
Here is what I get --


PHP Version: 5.1.4
PHP OS: WINNT
Error Reporting: 2047 (E_ALL)
Register Globals: Off
Short Tags: On
Display Errors: On
Loaded Extensions:
bcmath calendar com_dotnet ctype
date ftp hash iconv
odbc pcre Reflection session
libxml standard tokenizer zlib
SimpleXML dom SPL wddx
xml xmlreader xmlwriter


PHP Warning: PHP Startup: Unable to load dynamic library './php_mssql.dll' - The specified module could not be found. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library './php_mysql.dll' - The specified module could not be found. in Unknown on line 0

Posted: Mon Jul 17, 2006 4:22 pm
by RobertGonzalez
ratan wrote:Loaded Extensions:
bcmath
calendar
com_dotnet
ctype
date
ftp
hash
iconv
odbc
pcre
Reflection
session
libxml
standard
tokenizer
zlib
SimpleXML
dom
SPL
wddx
xml
xmlreader
xmlwriter
It appears you only have the ODBC DB extension loaded. You can try that or try loading the mssql extension.

By the way, have you tried restarting the server?

Posted: Mon Jul 17, 2006 4:28 pm
by ratan
Everah, thanks for your help.

I have done the installs atleast 10 times in last 2 days. I have used the windows installer for php 5 and then
extracted the zip version and copied files created in ext folder into the c:\php . So, now I can see php_mysql.dll loaded.

Still mssql_dll has issues. This is what I get when I run the test script again.

PHP Version: 5.1.4
PHP OS: WINNT
Error Reporting: 2047 (E_ALL)
Register Globals: Off
Short Tags: On
Display Errors: On
Loaded Extensions:
bcmath calendar com_dotnet ctype
date ftp hash iconv
odbc pcre Reflection session
libxml standard tokenizer zlib
SimpleXML dom SPL wddx
xml xmlreader xmlwriter mysql


PHP Warning: PHP Startup: Unable to load dynamic library 'c:\php\php_mssql.dll' - The specified module could not be found. in Unknown on line 0

Posted: Mon Jul 17, 2006 5:03 pm
by ratan
I just got it to work. I had done atleast 15 installs/uninstalls in last couple of days and I have no clue what happened, I did a refresh and boom it worked. Its freaky, but it works. Beats me!

Thank you so much for your help! :D

Posted: Mon Jul 17, 2006 5:06 pm
by RobertGonzalez
EDIT | OP figured it out, so this post was unnecessary.