News:

SMF 2.0.19 has been released! Please update. Read more.

Main Menu

MySQLi

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

Previous topic - Next topic

Arantor

I don't know, but you can still change it as directed above.
No good deed goes unpunished / All helpful urges should be circumvented

I have something to say: it's better to burn out than to fade away. There can be only one.

schmiesus

Weird I tried that last night and it didn't work....This morning it was fine.

riou

When db_type is set to mysqli, and something is searched in the advanced search, it gives a blank page and the following error in the error log:

index.php?action=search2
8: Undefined variable: smcFunc
File: Sources/SearchAPI-Fulltext.php
Line: 138


In the quick search box (in the top right) this error doesn't pop though, only when using advanced search.

When the db_type is swapped back to mysql the error goes away and advanced search is useable like expected.

SearchAPI-Fulltext.php is character for character the same thing as the base SMF install (no mod's or anything have changed it or added custom code).



If the function prepareIndexes is changed (basically adding global smcFunc) in that file to:

public function prepareIndexes($word, &$wordsSearch, &$wordsExclude, $isExcluded)
{
global $modSettings, $smcFunc;


It works the same as the mysql way works, but is this the 'wrong' way to fix it? Since the mysqli db_type seems to have this problem and not the old mysql way.

schmiesus

I had the same issue. I just replaced with google instead.

tinoest

Quote from: riou on October 28, 2013, 11:08:30 PM
When db_type is set to mysqli, and something is searched in the advanced search, it gives a blank page and the following error in the error log:

index.php?action=search2
8: Undefined variable: smcFunc
File: Sources/SearchAPI-Fulltext.php
Line: 138


In the quick search box (in the top right) this error doesn't pop though, only when using advanced search.

When the db_type is swapped back to mysql the error goes away and advanced search is useable like expected.

SearchAPI-Fulltext.php is character for character the same thing as the base SMF install (no mod's or anything have changed it or added custom code).



If the function prepareIndexes is changed (basically adding global smcFunc) in that file to:

public function prepareIndexes($word, &$wordsSearch, &$wordsExclude, $isExcluded)
{
global $modSettings, $smcFunc;


It works the same as the mysql way works, but is this the 'wrong' way to fix it? Since the mysqli db_type seems to have this problem and not the old mysql way.

Can you confirm if changing this in that file solves the issue.

From this :

protected $supported_databases = array('mysql');

To this :

protected $supported_databases = array('mysql' , 'mysqli');

riou

Quote from: tinoest on December 18, 2013, 06:41:40 PM
Quote from: riou on October 28, 2013, 11:08:30 PM
When db_type is set to mysqli, and something is searched in the advanced search, it gives a blank page and the following error in the error log:

index.php?action=search2
8: Undefined variable: smcFunc
File: Sources/SearchAPI-Fulltext.php
Line: 138


In the quick search box (in the top right) this error doesn't pop though, only when using advanced search.

When the db_type is swapped back to mysql the error goes away and advanced search is useable like expected.

SearchAPI-Fulltext.php is character for character the same thing as the base SMF install (no mod's or anything have changed it or added custom code).



If the function prepareIndexes is changed (basically adding global smcFunc) in that file to:

public function prepareIndexes($word, &$wordsSearch, &$wordsExclude, $isExcluded)
{
global $modSettings, $smcFunc;


It works the same as the mysql way works, but is this the 'wrong' way to fix it? Since the mysqli db_type seems to have this problem and not the old mysql way.

Can you confirm if changing this in that file solves the issue.

From this :

protected $supported_databases = array('mysql');

To this :

protected $supported_databases = array('mysql' , 'mysqli');


That does fix it, yes :)

tinoest

Hi,

I've updated the package based upon the above bug report. It should work OK now.

Thanks for the feedback.

riou

#27
With mysql 5.6 this version needs the same fix the base smf got in version 2.0.8 in its Subs-Db-mysql file (same as Arantor's mod did: http://custom.simplemachines.org/mods/index.php?mod=3865 ) to allow it to properly sort the boards


There was also an edit in 2.0.9 (to the base mysql version)

find:
if (strpos($db_string, 'GROUP BY') !== false && strpos($db_string, 'ORDER BY') === false && strpos($db_string, 'INSERT INTO') === false)

replace that with:
if (strpos($db_string, 'GROUP BY') !== false && strpos($db_string, 'ORDER BY') === false && preg_match('~^\s+SELECT~i', $db_string))


Assume this would also need changed for the mysqli version?

acsieben

#28
Hi,

The 1.0.1 package is being recognised correctly but 1.0.2 is not. The error when uploading it is:

QuoteAn Error Has Occurred!
Package upload failed due to the following error:
"Although the package was downloaded to the server it appears to be empty. Please check the Packages directory, and the "temp" sub-directory are both writable. If you continue to experience this problem you should try extracting the package on your PC and uploading the extracted files into a subdirectory in your Packages directory and try again. For example, if the package was called shout.tar.gz you should:
1) Download the package to your local PC and extract it into files.
2) Using an FTP client create a new directory in your "Packages" folder, in this example you may call it "shout".
3) Upload all the files from the extracted package to this directory.
4) Go back to the package manager browse page and the package will be automatically found by SMF."

I've checked and the ZIP file extracts fine.

Edit: I noticed that the only file change that had been made was with "Subs-Db-mysqli.php" so I basically overwrote it. It's apparently working with PHP 7.1 on my setup.

Cheers

acsieben

Following up on my last comment, I had to disable Database driven sessions, the board wouldn't run properly otherwise. I couldn't even log in the admin backend, so I had to manually change the value in the database "_settings" > "databaseSession_enable" 

The related errors in the database were:

"2: session_start(): Failed to read session data: user (path: /tmp)" - I changed it to another folder and it still wouldn't make a difference.
"2: Parameter 1 to optimus_buffer() expected to be a reference, value given" - regarding PHPSESSION


(I'm still getting the second error  though - a lot)

Adz.

#30
Anyone guide me how to install this manually?
i'm trying to get 2.0x to work on php 7 but i seem to get this error on installation page.

Critical Error!
The installer was unable to detect any database support in PHP. Please ask your host to ensure that PHP was compiled with the desired database, or that the proper extension is being loaded

d3vcho

"Greeting Death as an old friend, they departed this life as equals"

caribe1999

This mod brakes the admin panel with 2.0.15 because it does not provide che $smcFunc['db_get_engine'] method.

The fix is simple. Just open DBExtra-mysqli.php, in db_extra_init() add this to the array:

'db_get_engine' => 'smf_db_get_engine'

And then copy the smf_db_get_engine() function from DBExtra-mysql.php and paste it on the bottom.

tinoest

Quote from: caribe1999 on November 25, 2017, 02:15:16 AM
This mod brakes the admin panel with 2.0.15 because it does not provide che $smcFunc['db_get_engine'] method.

The fix is simple. Just open DBExtra-mysqli.php, in db_extra_init() add this to the array:

'db_get_engine' => 'smf_db_get_engine'

And then copy the smf_db_get_engine() function from DBExtra-mysql.php and paste it on the bottom.

This mod is no longer required since 2.0.14 and I'd recommend removing it.

caribe1999


live627

To elaborate: SMF 2.0.14 includes this driver.

Advertisement: