Welcome Guest, Not a member yet? Register   Sign In
CI 3 won't connect to MSSQL 2012 database under php 5.6 on Rackspace
#1

Our site is on Rackspace cloud sites and is currently running fine with Codeigniter 3.0.0 on PHP 5.4.1.0 and connecting to a MSSQL 2012 database. Rackspace is in the process of upgrading PHP from 5.4.1.0 to 5.6.7-1 and has given testlinks for testing our websites in the new PHP environment. In this test environment, the site does not connect to the MSSQL database. However - no errors are thrown (that I can find, anyway!)

This is what I have for my database configuration:

PHP Code:
$db['default'] = array(
 
   'dsn'   => '',
 
   'hostname' => 'mssqlXXXX.XXX',
 
   'username' => 'USERNAME',
 
   'password' => 'PASSWORD',
 
   'database' => 'DATABASE NAME',
 
   'dbdriver' => 'mssql',
 
   'dbprefix' => '',
 
   'pconnect' => FALSE,
 
   'db_debug' => TRUE,
 
   'cache_on' => FALSE,
 
   'cachedir' => '',
 
   'char_set' => 'utf8',
 
   'dbcollat' => 'utf8_general_ci',
 
   'swap_pre' => '',
 
   'encrypt' => FALSE,
 
   'compress' => FALSE,
 
   'stricton' => FALSE,
 
   'failover' => array(),
 
   'save_queries' => TRUE
); 

As a test, Rackspace also had me write a test controller. This works in Codeigniter:

PHP Code:
$username "USERNAME";
$password "PASSWORD";
$hostname 'mssqlXXXX.XXX';
$dbname "DATABASE";

//connection to the database
$dbcon mssql_connect($hostname$username$password)or die("Unable to connect to MSSQL");
echo 
"Connected to MSSQL";

//select the database
mssql_select_db($dbname$dbcon);

//SQL Select statement
$sqlselect "SELECT * FROM INFORMATION_SCHEMA.TABLES";

//Run the SQL query
$sqlquery mssql_query($sqlselect);

//Output the query results
while ($result mssql_fetch_array($sqlquery) )
{
 
   echo "<br>";
 
   print_r($result);
 
   echo "<br>";


Any clues why the standard Codigniter database connection is not working?
Reply
#2

It turns out that this was a Rackspace issue and it has been corrected. Problem solved.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB