News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

MySQLi

Started by tinoest, September 21, 2012, 05:28:40 PM

Previous topic - Next topic

tinoest

Link to Mod

This modification will add MySQLi support to SMF.

It is a simple install the package and change your settings

From
$db_type = mysql';
To:
$db_type = mysqli';

Please ensure that you have mysqli installed before using this modification.  If it doesn't work then just revert your db_type to mysql.

IMPORTANT: As of SMF 2.0.14 this Mod is no longer required.


Revision History :

1.0.0 - Initial Release
1.0.1 - Bug fix to full text search API functionality.
1.0.2 - Added Fixes from later versions of SMF

Quote
Copyright © 2012 tinoest.  All rights reserved.

Developed by: tinoest
              http://www.tinoest.no-ip.org

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
  1. Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimers.
  2. Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimers in the
     documentation and/or other materials provided with the distribution.
  3. Neither the names of tinoest, nor the names of its contributors may be
     used to endorse or promote products derived from this Software without
     specific prior written permission.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
WITH THE SOFTWARE.

This license may be viewed online at http://opensource.org/licenses/BSD-3-Clause

hhy89

any problem with those control?
if ($db_type == 'mysql')
line 363 in ManageSearch.php

if ($db_type == 'mysql' && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51')))
line 468 in ScheduledTasks.php

$context['convert_utf8'] = $db_type == 'mysql' && (!isset($db_character_set) || $db_character_set !== 'utf8' || empty($modSettings['global_character_set']) || $modSettings['global_character_set'] !== 'UTF-8') && version_compare('4.1.2', preg_replace('~\-.+?$~', '', $smcFunc['db_server_info']())) <= 0;
$context['convert_entities'] = $db_type == 'mysql' && isset($db_character_set, $modSettings['global_character_set']) && $db_character_set === 'utf8' && $modSettings['global_character_set'] === 'UTF-8';

line 212 and 213 in ManageMaintenance.php
ManageMaintenance.php

thank u
Seo4Smf 2.0 - Full Top10 Stats(full top10) - Aligned and Bilateral Child Boards(2li 3lü alt bölümler)
http://www.smfmod.com
http://destek.smfmod.com

tinoest

Quote from: hhy89 on September 30, 2012, 06:15:05 AM
any problem with those control?
if ($db_type == 'mysql')
line 363 in ManageSearch.php

if ($db_type == 'mysql' && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51')))
line 468 in ScheduledTasks.php

$context['convert_utf8'] = $db_type == 'mysql' && (!isset($db_character_set) || $db_character_set !== 'utf8' || empty($modSettings['global_character_set']) || $modSettings['global_character_set'] !== 'UTF-8') && version_compare('4.1.2', preg_replace('~\-.+?$~', '', $smcFunc['db_server_info']())) <= 0;
$context['convert_entities'] = $db_type == 'mysql' && isset($db_character_set, $modSettings['global_character_set']) && $db_character_set === 'utf8' && $modSettings['global_character_set'] === 'UTF-8';

line 212 and 213 in ManageMaintenance.php
ManageMaintenance.php

thank u

I can't see any reason there would be. Are you having any issues?

hhy89

i dont use it now but ill use later. and if i get any error, i will say.
thanks for this good work
Seo4Smf 2.0 - Full Top10 Stats(full top10) - Aligned and Bilateral Child Boards(2li 3lü alt bölümler)
http://www.smfmod.com
http://destek.smfmod.com

humbleworld

what would be the benefits of using this MOD? thanks for making it.

tinoest

Quote from: humbleworld on November 22, 2012, 04:48:19 PM
what would be the benefits of using this MOD? thanks for making it.

You have to judge in the benefits listed here are sufficient to change. Some hosts also don't provide MySQL now as its been depreciated in PHP 5.4

http://www.php.net/manual/en/mysqli.overview.php

Colin

An object-oriented interface
Support for prepared statements
Support for multiple statements
Support for transactions
Enhanced debugging support
Embedded server support
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

littlenicki

Does this mod also work on SMF 1.1.X when manually installed?
Fomer SMF user. Switched to Invision Power Board and VBulletin

live627

No. SMF 1.1.x does not have a database abstraction layer. It uses the raw mysql_* functions in every file. So, as you may imagine, this mod will be a total nightmare to backport.

schmiesus

I must be really blind I can not find where I switch that setting

Colin

Switch what setting? Would you mind elaborating.
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

schmiesus

Quote from: tinoest on September 21, 2012, 05:28:40 PM
Link to Mod

This modification will add MySQLi support to SMF.

It is a simple install the package and change your settings

From
$db_type = mysql';
To:
$db_type = mysqli';

this setting. I can't find it.

emanuele

Edit your Settings.php. ;)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

schmiesus

Ok well in that case I have a larger problem cause I do not have that line in my settings file

Arantor

What version of SMF?

schmiesus


Arantor

Then there is absolutely no reason for you not to have a line that starts $db_type in your Settings.php file. In fact it shouldn't work properly without it.

schmiesus

<?php
/**********************************************************************************
* Settings.php                                                                    *
***********************************************************************************
* SMF: Simple Machines Forum                                                      *
* Open-Source Project Inspired by Zef Hemel ([email protected])                    *
* =============================================================================== *
* Software Version:           SMF 1.1                                             *
* Software by:                Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006 by:          Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
* Support, News, Updates at:  http://www.simplemachines.org                       *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version can always be found at http://www.simplemachines.org.        *
**********************************************************************************/

########## Maintenance ##########
# Note: If $maintenance is set to 2, the forum will be unusable!  Change it to 0 to fix it.
$maintenance 0; # Set to 1 to enable Maintenance Mode, 2 to make the forum untouchable. (you'll have to make it 0 again manually!)
$mtitle 'Updating'; # Title for the Maintenance Mode message.
$mmessage 'To improve the safety on the forum we are doing a small security update'; # Description of why the forum is in maintenance mode.

########## Forum Info ##########
$mbname 'Dubberz Forums'; # The name of your forum.
$language 'english'; # The default language file set for the forum.
$boardurl 'http://dubberz.com/forum'; # URL to your forum's folder. (without the trailing /!)
$webmaster_email '[email protected]'; # Email address to send emails from. (like [email protected].)
$cookiename '************'; # Name of the cookie to set for authentication.

########## Database Info ##########
$db_server '127.0.0.1';
$db_name '************';
$db_user '************';
$db_passwd '************';
$db_prefix 'smf_';
$db_persist 0;
$db_error_send 0;

########## Directories/Files ##########
# Note: These directories do not have to be changed unless you move things.
$boarddir '************'; # The absolute path to the forum's folder. (not just '.'!)
$sourcedir '************'; # Path to the Sources directory.

########## Error-Catching ##########
# Note: You shouldn't touch these settings.
$db_last_error 1282157429;

# Make sure the paths are correct... at least try to fix them.
if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt'))
$boarddir dirname(__FILE__);
if (!
file_exists($sourcedir) && file_exists($boarddir '/Sources'))
$sourcedir $boarddir '/Sources';

$cachedir '*****';
$ssi_db_user '';
?>

Arantor

I direct your attention to:
Quote* Software Version:           SMF 1.1                                             *

However if you really are using 2.0 (since the upgrader should replace that part of the settings file), you can just add:
$db_type = 'mysqli';

under where all the other $db settings are.

schmiesus

Quote from: Arantor on October 22, 2013, 10:50:04 AM
I direct your attention to:
Quote* Software Version:           SMF 1.1                                             *

um so how does that work.......




Advertisement: