Page 1 of 1

CMSMS with MSSQL on Windows

Posted: Tue Mar 24, 2009 5:52 am
by tommy1402
Here is my experience to make my CMSMS runs on MSSQL on Windows... I hope it helps...

Preparation
(1a). Prepare CMS Made Simple v1.4.1 (next, we call it CMSMS)
(1b). Prepare AdoDB Full 5.0.5 (next, we call it ADODB)
(1c). Place CMSMS in the webserver directori (usually htdocs)
(1d). copy ADODB to folder CMSMS\LIB\
(1e). Create database in MSSQL, let's name it CMSMSDB

MSSQL addition in installation list
(2a). Go to folder CMSMS\INSTALL\LIB\CLASSES\ and edit file: CMSInstallerPage4.class.php
(2b). At line 53, add:

Code: Select all

,array('name' => 'mssql', 'title' => 'MSSQL')
then save it.

DT data-dictionary addition for DATETIME in MSSQL
(3a). Go to folder CMSMS\LIB\ADODB\DATADICT\ and edit file: datadict-mssql.inc.php
(3b). At line 92, add:

Code: Select all

case 'DT': return 'DATETIME';
then save it.

Activate ADODB-Full to replace ADODB-Lite
(4a). Go to folder CMSMS\LIB\ and edit file: adodb.functions.php
(4b). At line 19, add:

Code: Select all

$config['use_adodb_lite'] = false;
then save it. This line will be deleted after CMSMS instalation finishes.

CMSMS installation
(5a). Proceed into intallation by visiting URL: http://localhost/cmsms/install
(5b). When you reach step 4 (Database configuration), enter these data:
      Database host address : {fill it with your computer name or IP}
      Database name : CMSMSDB
      Username : sa
      Password : {sa password}
(5c). Press continue, and when success you will see message [done]

Replace ADODB-Lite with ADODB-Full permanently
(6a). After you reach step 6 along with message Congratulations, you are all setup and before you click link CMS Site
(6b). Remove

Code: Select all

$config['use_adodb_lite'] = false;
within step (4b)
(6c). Go to folder CMSMS\ and edit file: config.php
(6d). At line 65, change the code into

Code: Select all

$config['use_adodb_lite'] = false;
then save it.
(6e). Activate your browser, and click link CMS Site

Fixing query in CMSMS
(7a). You will see message Not Found. The requested URL was not found on this server.
(7b). Go to folder CMSMS\LIB\CLASSES\ and edit file: class.pageinfo.inc.php
(7c). Go to 106, where this code resides:

Code: Select all

$query = "SELECT c.content_id, c.content_name, c.content_alias, c.menu_text, c.titleattribute, c.hierarchy, c.metadata, c.id_hierarchy, c.prop_names, c.create_date AS c_create_date, c.modified_date AS c_date, c.cachable, c.last_modified_by, t.template_id, t.encoding, t.modified_date AS t_date FROM ".cms_db_prefix()."templates t INNER JOIN ".cms_db_prefix()."content c ON c.template_id = t.template_id WHERE (c.content_alias = ? OR c.content_id = ?) AND c.active = 1";
(7d). Change it into:

Code: Select all

$query = "SELECT c.content_id, c.content_name, c.content_alias, c.menu_text, c.titleattribute, c.hierarchy, c.metadata, c.id_hierarchy, c.prop_names, c.create_date AS c_create_date, c.modified_date AS c_date, c.cachable, c.last_modified_by, t.template_id, t.encoding, t.modified_date AS t_date FROM ".cms_db_prefix()."templates t INNER JOIN ".cms_db_prefix()."content c ON c.template_id = t.template_id WHERE (c.content_alias = cast( ? as varchar ) OR c.content_id = ?) AND c.active = 1";
notice the changed part

Code: Select all

c.content_alias = cast( ? as varchar )
The problem is c.content_alias has type varchar so it can't be compared directly with integer, CAST command is needed.
(7e). Re-activate, press F5 (Refresh).

Module TinyMCE small fix
(8a). Open this URL: http://localhost/cmsms/admin/ dan login
(8b). Notice that, fitur WYSIWYG is not activated when you want to create a content (via News maybe)
(8c). Go to folder CMSMS\MODULES\TinyMCE\ and edit file: TinyMCE.module.php
(8d). Go to line 557, change it to

Code: Select all

$extraconfig="//Extra configuration";
save it.
(8e). Activate browser, and press F5.

PHP configuration for MSSQL
(9a). (For Windows) go to Apache folder  XAMPP\APACHE\BIN\ adn edit file: php.ini
(9b). Go to line 1100 change it to

Code: Select all

mssql.textlimit = 2147483647
(9c). Go to line 1103 change it to

Code: Select all

mssql.textsize = 2147483647
then save it.
(9d). Restart Apache

Done
(10). Voila, 100% functional CMS Made Simple within MSSQL.