Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible installation with mysql cause of "Unknown system variable 'storage_engine'" #818

Open
Flip1 opened this issue Nov 26, 2023 · 11 comments

Comments

@Flip1
Copy link

Flip1 commented Nov 26, 2023

The following error makes a install of s9y impossible:
Unknown system variable 'storage_engine'

The use of "storage-engine" is maybe deprecated and leads to this error.
This should be changed to "default_storage_engine".
See here

The following changes will fix this issue:
File: include/db/mysqli.inc.php
Line: 296 and 300

Replace:
serendipity_db_query("SET storage_engine=
with:
serendipity_db_query("SET default_storage_engine=

This happens with s9y version 2.4.0 and 2.5beta1.
Version of MySQL or MariaDB is: 8.0.34-26

@garvinhicking
Copy link
Member

Thanks for reporting! Since we also support older sql versions, we'll need to add a switch here. We don't have specific mysql version checking, so maybe the easier way is to let the query fail, catch the failure, and then issue the other engine command.

We should use the mysql8 syntax as default and only fall back to the "old" variant.

Thoughts? @onli ?

@onli
Copy link
Member

onli commented Nov 26, 2023

Thoughts? @onli ?

I thought we already had the storage_engine bug fixed in the beta. Have a look at

if (serendipity_is_maria() || version_compare($mysql_version, '5.7', '<')) {
# MySQL has dropped the storage_engine setting in 5.7, so we only need to set it in MariaDB or earlier MySQL version
if (serendipity_utf8mb4_ready()) {
# InnoDB enables us to use utf8mb4 with the higher max index size
serendipity_db_query("SET storage_engine=INNODB");
} else {
# Before 5.6.4/10.0.5 InnoDB did not support fulltext indexes, which we use,
# thus we stay with MyISAM here
serendipity_db_query("SET storage_engine=MYISAM");
}
}

The idea there was to solve the MySQL bug by not setting the storage_engine at all in MySQL >= 5.8. But it seems my assumption was wrong how MariaDB behaves. Was discussed (and tested) in https://board.s9y.org/viewtopic.php?t=26120.

I'd probably would have added a second version check:

 if (serendipity_utf8mb4_ready()) {
       # InnoDB enables us to use utf8mb4 with the higher max index size
     if (version_compare($mysql_version, '5.7', '>')) {
        # We know we use MariaDB here, and versions after 5.7 prefer default_storage_engine.
        serendipity_db_query("SET default_storage_engine=INNODB");
     } else {
        serendipity_db_query("SET storage_engine=INNODB");
     }
} else {
     # Before 5.6.4/10.0.5 InnoDB did not support fulltext indexes, which we use,
     # thus we stay with MyISAM here
    if (version_compare($mysql_version, '5.7', '>')) {
        # We know we use MariaDB here, and versions after 5.7 prefer default_storage_engine.
        serendipity_db_query("SET default_storage_engine=MYISAM");
     } else {
        serendipity_db_query("SET storage_engine=MYISAM");
     }
}

But that's a version check after a version check and a lot of ifs. Probably not a good idea. To use the default_storage_engine by default and catch the error for old versions is probably smarter, then we can put the old code into the rescue/catch as-is.

@onli
Copy link
Member

onli commented Feb 13, 2024

I just checked upon this code, since we just released 2.5.0, but I think this bug here was missed. Someone available to run the code as shown in #818 (comment) on mariadb?

@Flip1
Copy link
Author

Flip1 commented Feb 17, 2024

I wanted to try it out, but a new installation failed somewhere else: [#822]

The automatic update from 2.5beta to 2.5 doesn't work, but with FTP-Upload everything works fine.

@Flip1
Copy link
Author

Flip1 commented Feb 20, 2024

The installation of unchanged 2.5 is now running smoothly.
So, I have not tested the above code and I think this issue can be closed.
Or should I test something special?

@onli
Copy link
Member

onli commented Feb 20, 2024

It worked without you having to change anything, while you were trying to use MariaDB?

@Flip1
Copy link
Author

Flip1 commented Feb 21, 2024

When I created this error I wasn't entirely sure, now I know that Limacity is running MySQL 8.0.34-26.
This error occurred here with 2.4.0 and 2.5beta1.
But now I was able to install 2.5 without changes and without any problems. Seems like this bug has been fixed.
I haven't tested it with MariaDB, but I could test it locally. But maybe next week.

@onli
Copy link
Member

onli commented Feb 21, 2024

Awesome :) If you want to test it we can keep this open, if not we can close here (or we can close and then re-open, as you prefer)

@Flip1
Copy link
Author

Flip1 commented Mar 5, 2024

Okay, I have now set up a test environment on Debian Bookworm (stable):

  • Apache 2.4.57-2
  • PHP 8.2.7-1
  • MariaDB 1:10.11.6-0

Serendipity seems to run fine with MariaDB, the installation went smoothly.
However, there seems to be a problem with PHP 8.2, which is why the blog cannot load. Apparently the built-in library for 8.1 does not work with PHP 8.2.

PHP Fatal error: Uncaught Error: Class "IntlDateFormatter" not found in /var/www/s9y/bundled-libs/php81_bc/strftime/src/php-8.1-strftime.php:60\nStack trace:
#0 /var/www/s9y/bundled-libs/php81_bc/strftime/src/php-8.1-strftime.php(201): PHP81_BC\{closure}()
#1 [internal function]: PHP81_BC\{closure}()
#2 /var/www/s9y/bundled-libs/php81_bc/strftime/src/php-8.1-strftime.php(180): preg_replace_callback()
#3 /var/www/s9y/include/functions.inc.php(143): PHP81_BC\strftime()
#4 /var/www/s9y/include/functions.inc.php(191): serendipity_strftime()
#5 /var/www/s9y/plugins/serendipity_plugin_archives/serendipity_plugin_archives.php(105): serendipity_formatTime()
#6 /var/www/s9y/include/plugin_api.inc.php(971): serendipity_plugin_archives->generate_content()
#7 /var/www/s9y/include/functions_smarty.inc.php(645): serendipity_plugin_api::generate_plugins()
#8 /var/www/s9y/templates_c/2k11/a3/7e/d1/a37ed1f6570390f01a8643f6fef38d367196cfb9_0.file.index.tpl.php(163): serendipity_smarty_printSidebar()
#9 /var/www/s9y/bundled-libs/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_65e72b4f6c5326_76947008()
#10 /var/www/s9y/bundled-libs/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()
#11 /var/www/s9y/bundled-libs/smarty/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render()
#12 /var/www/s9y/bundled-libs/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render()
#13 /var/www/s9y/bundled-libs/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute()
#14 /var/www/s9y/index.php(124): Smarty_Internal_TemplateBase->display()
#15 {main}
thrown in /var/www/s9y/bundled-libs/php81_bc/strftime/src/php-8.1-strftime.php on line 60, referer: http://localhost//serendipity_admin.php?

@garvinhicking
Copy link
Member

It seems you are missing the Debian package "php8-intl"?

@Flip1
Copy link
Author

Flip1 commented Mar 5, 2024

Yeah that's it! php8.2-intl was not installed.
Now I can confirm that Serendipity 2.5 runs smoothly with MariaDB and PHP 8.2. At least in my test environment!

The only thing that could possibly be improved is a test during installation to see whether php8.2-intl is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants