Welcome Guest, Not a member yet? Register   Sign In
mssql 2008 with PHP 5.3.2 and CI 1.7.2
#11

[eluser]Unknown[/eluser]
I found myself in a similar situations as OP...had to install a PHP product on Windows 2008 R2, IIS 7, MS SQL 2008 and PHP 5.3.2. On my dev machine all was working fine (Windows Vista, MS SQL 2008 Express, PHP 5.2.4).

The issue:
With regards to PHP 5.3.2...hmm, it seems PHP 5.3.2 does not ship with any MSSQL drivers...you have to download a driver from Microsoft (http://www.microsoft.com/sqlserver/2005/...river.aspx). Anyway, this has its own issues as the driver does not work with Codeigniter because it does not have the standard MSSQL API we are used to in PHP...according to the docs included in the download for the new dlls you have to use sqlsrv_connect instead of mssql_connect for example). SOOOO...it seems we need a new/updated SQLSrv Codeigniter driver class or modify the existing MSSQL driver class.

The fix:
I suggest you do not use PHP 5.3.2 to connect to MSSQL for now. I removed PHP 5.3.2 from the machine and installed the non thread safe PHP 5.2.13. That still comes with the standard MSSQL drivers. Codeigniter's MSSQL class can work with the MSSQL dll that gets shipped with PHP 5.2.13. On my machine I also had to update the ntwdblib.dll (but not on the client machine). On my machine the ntwdblib.dll was "outdated" according to some forums...I needed the 2000.80.194.0 version...which I downloaded. I had to replace each "old" ntwdblib.dll with the new one (had to stop the web server on my dev machine first) and then suddenly I could connect to MSSQL 2008 with PHP 5.2.4 using CodeIgniter 1.7.2...I did not have to make any changes to the Codeigniter database classes (had to modify some queries to work with MSSQL though...espcially in terms of queries that used LIMIT of course). My settings that worked are:

Code:
$db['default']['hostname'] = 'machinename\instance'; //in my case 'Juggernaut\SQL2008' but could be an IP address too
$db['default']['username'] = "user";
$db['default']['password'] = "passw";
$db['default']['database'] = "mydatabase";
$db['default']['dbdriver'] = "mssql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";

So, first try that out (PHP 5.2.13 and if needed update ntwdblib.dll) and make sure your database config file is set to use the mssql driver and not mysql (obvious I know, but just saying).

Let me know you you do not come right. There are more details with other PHP/IIS related things I struggled with (file permissions mostly - to write logs etc.) that I eventually got working...let me know if you need more info. They were not Codeigniter related though...just putting it out here.

In the mean time I will see about that new driver for PHP 5.3.2...its new to me and Im probably missing something obvious...but will probably end up modifying the existing Codeigniter MSSQL classes (which works with the php_mssql dll) to make a new SQLSRV driver (to work with the new php_sqlsrv dlls you download from Microsoft) to work in Codeigniter.


Messages In This Thread
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 06-23-2010, 10:53 PM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 06-23-2010, 10:55 PM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 06-23-2010, 11:03 PM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 06-23-2010, 11:24 PM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 06-24-2010, 02:15 AM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 06-24-2010, 08:36 AM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 06-24-2010, 08:42 AM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 06-24-2010, 08:45 AM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 06-24-2010, 08:46 AM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 06-24-2010, 11:08 PM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 07-01-2010, 02:31 AM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 12-01-2010, 04:07 PM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 12-01-2010, 05:13 PM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 12-03-2010, 04:45 PM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 12-09-2010, 02:57 PM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 12-10-2010, 03:18 AM
mssql 2008 with PHP 5.3.2 and CI 1.7.2 - by El Forum - 12-10-2010, 03:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB