Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: margarett on April 05, 2016, 05:43:36 AM

Title: SMF 2.0.x installer cannot detect database support
Post by: margarett on April 05, 2016, 05:43:36 AM
SMF 2.0 currently does not support MySQLi, which is the default database engine for PHP 7.x. As a result, you may receive the following error when installing SMF on a MySQLi database:

QuoteCritical 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.

The Team is working to resolve this issue, but in the meantime, if you receive this error, you need to downgrade your PHP version to 5.6.x and make sure that this version supports MySQL.
If you are getting this error on your local computer (eg, you are using XAMPP (http://apachefriends.org) or another WAMP/LAMP), please make sure you download a version which uses PHP 5.6.x instead of PHP 7.x
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: Hubert1965 on August 09, 2016, 10:22:24 AM
Downgrading to an old version is not acceptable!

You posted this info in April 05. Now we have August 09. Four month later! And it is still not possible to install SMF on a new Ubuntu 16.04 server with its standard version of PHP.
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: Arantor on August 09, 2016, 10:46:14 AM
PHP 5.6 is still fully supported by the PHP project, so there is no reason why downgrading is bad here.
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: TemplateJuggler on December 09, 2016, 11:06:36 AM
What is the latest info on this issue? Me too would like to use SMF with PHP 7.
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: Kindred on December 09, 2016, 11:11:46 AM
the latest info is that SMF 2.0.x still does not support php 7.  It will, eventually, but it is not a priority right now.
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: TemplateJuggler on December 09, 2016, 11:19:11 AM
Ok, thank you.
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: TemplateJuggler on December 10, 2016, 11:41:01 AM
I was able to hack the latest installer to work with PHP 7 and MySQLi.
In case anyone needs that I share what I did below.

First, I added mysqli into the install.php.
I just copied over the existing mysql section and changed mysql to mysqli and replaced mysql_get_server_info with smf_db_get_server_info:


'mysqli' => array(
'name' => 'MySQLi',
'version' => '4.0.18',
'version_check' => 'return min(smf_db_get_server_info(), mysqli_get_client_info());',
'supported' => function_exists('mysqli_connect'),
'default_user' => 'mysql.default_user',
'default_password' => 'mysql.default_password',
'default_host' => 'mysql.default_host',
'default_port' => 'mysql.default_port',
'utf8_support' => true,
'utf8_version' => '4.1.0',
'utf8_version_check' => 'return smf_db_get_server_info();',
'utf8_default' => false,
'utf8_required' => false,
'alter_support' => true,
'validate_prefix' => create_function('&$value', '
$value = preg_replace(\'~[^A-Za-z0-9_\$]~\', \'\', $value);
return true;
'),
),


I created a copy of install_2-0.mysql.sql as install_2-0.mysqli.sql

I took tinoest's MySQLi mod (http://custom.simplemachines.org/mods/index.php?mod=3469) and copy the 4 PHP files from it into the installer Sources folder.

Finally, I changed "mysql" in Settings.php to "mysqli"

I saw a deprecated warning, but otherwise 2.0.12 installed and works without any issue so far on PHP 7 using MySQLi.




Title: Re: SMF 2.0.x installer cannot detect database support
Post by: TemplateJuggler on December 10, 2016, 12:43:46 PM
I think I should clarify: this is only a hack and while it seems to work there is no guarantee, so use at your own risk. I only use this for development / testing purposes, not on production.
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: vbgamer45 on December 10, 2016, 01:15:27 PM
Yeah 7.0 is not that bad minor changes for the most part main thing is just the mysql_ functions gone. In a big project i just replaced with mysqli and worked great. I am thinking about dong the same for SMF 1.1.x
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: Kindred on December 10, 2016, 05:47:42 PM
It is not recommended to do this...

we have an official patch being worked on, and doing this will prevent you from applying the official (and code tested) patch
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: hollermann on December 15, 2016, 03:02:53 PM
Any News about smf 2 and php 7? My provider is forcing their customers to upgrade to php 7. I did it for my smf installation and it didn't work (critical error, mysql-connect unknown or something like that).
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: d3vcho on December 15, 2016, 03:06:33 PM
You should change your provider... SMF doesn't provide any dates for upcoming releases.

Regards :)
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: ThisSucks on January 30, 2017, 08:28:20 PM
Quote from: Kindred on December 09, 2016, 11:11:46 AM
the latest info is that SMF 2.0.x still does not support php 7.  It will, eventually, but it is not a priority right now.
Is there a way to fix this or should everyone switch to phpbb? I have PHP 5.5 installed and I'm getting the same message.
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: Kindred on January 30, 2017, 08:45:51 PM
You would not see that message with php5 or php6. 

Also
Quote from: Kindred on December 10, 2016, 05:47:42 PM

we have an official patch being worked on
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: xXxbigdogxXx on May 20, 2018, 07:58:32 PM
Sorry to do this guys but I am in the needs of this as well.

BUMP
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: shawnb61 on May 20, 2018, 08:03:41 PM
This is a very old thread...

2.0.14+ supports mysqli, php7.0 & php7.1.

Php7.2 is not yet supported.

If you are having an issue, you should start a thread in the 2.0 support board.
Title: Re: SMF 2.0.x installer cannot detect database support
Post by: xXxbigdogxXx on May 20, 2018, 08:09:03 PM
I have!