Odd combo

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Odd combo

Post 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.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Is the mssql.dll file in your extension dir?
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Post by ratan »

yeah it is php5 so it is part of the ext directory
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Make a php info page and see what extensions are loaded.

Code: Select all

<?php
phpinfo();
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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";
}

?>
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Post 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
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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?
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Post 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
ratan
Forum Commoner
Posts: 28
Joined: Thu Jul 13, 2006 4:22 pm

Post 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
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

EDIT | OP figured it out, so this post was unnecessary.
Post Reply