Welcome Guest, Not a member yet? Register   Sign In
Connection issues with MSSQL and IIS
#1

[eluser]trahma[/eluser]
I've been trying to start moving our systems in the direction of CodeIgniter but I've been fighting every step of the way with IIS. I feel like I'm close, but not close enough yet. The problem I'm now experiencing is that I keep getting the error message

Quote:Your database.php file does not appear to contain a valid configuration array.

I've been trying to find a way to track this problem down without much success. I have the error logging threshold up to 4 and I'm not seeing anything in my logs file. I have the database value set in my $autoload['config'] array so I know I'm good there. Also, I have a php application I wrote already connecting to MSSQL so I know that my problem shouldn't be there. Here's my database.php config file:

Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

$active_group = "default";

$db['default']['hostname'] = "dbserver";
$db['default']['username'] = "username";
$db['default']['password'] = "password";
$db['default']['database'] = "shows";
$db['default']['dbdriver'] = "mssql";
$db['default']['dbprefix'] = "";
$db['default']['active_r'] = TRUE;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";


?>

Obviously I changed the hostname, username, and password settings for the post, but I've tried referring to the database server (it's a separate box from my IIS system) by both the hostname and IP address. Are there any other hooks somewhere to turn database logging up or is there something I'm missing?
#2

[eluser]trahma[/eluser]
I did some more testing and put this file in my root directory of code igniter:

Code:
database tester<br /><br />
&lt;?
  include('system/application/config/database.php');
  echo "php is working<br /><br />";
      $c = mssql_connect($db['default']['hostname'], $db['default']['username'], $db['default']['password']) or die('ROO - Error: Could not connect to database.  Please contact your Systems Administrator!');
    mssql_select_db($db['default']['database'],$c);
    $results=mssql_query('SELECT * FROM states',$c);

    echo "MSSQL rows returned: ".mssql_num_rows($results)."<br />";

    if($myrow=mssql_fetch_row($results))
    {
        do {
            echo 'Shortname: '.$myrow[1].'<br />';
        } while($myrow=mssql_fetch_row($results));
    }
?&gt;

This code seems to run fine without errors which leads me to believe there's a CI issue somewhere. I'm running SQL2000 as well, I'm assuming that's supported fine since PHP doesn't have a problem with it.
#3

[eluser]Shadowhand[/eluser]
You aren't supposed to put "database" in the config autoloader. Database config file loading is done by DB directly.

(I actually already discussed this with trahma directly, I'm just putting the information here in case this happens to someone else.)
#4

[eluser]trahma[/eluser]
in other words, the video tutorial is wrong. Wink




Theme © iAndrew 2016 - Forum software by © MyBB