CommentFileSizeAuthor
asd.gif91.56 KBvibrasphere
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vibrasphere created an issue. See original summary.

vibrasphere’s picture

Issue summary: View changes

a

Log
Warning: mysqli::set_charset(): Couldn't fetch mysqli in BackupMigrate\Core\Source\MySQLiSource->_getConnection() (line 139 of /var/www/d8/htdocs/modules/backup_migrate/vendor/backupmigrate/core/src/Source/MySQLiSource.php) #0 /var/www/d8/htdocs/core/includes/bootstrap.inc(548): _drupal_error_handler_real(2, 'mysqli::set_cha...', '/var/www/d8.tek...', 139, Array) #1 [internal function]: _drupal_error_handler(2, 'mysqli::set_cha...', '/var/www/d8.tek...', 139, Array) #2 /var/www/d8/htdocs/modules/backup_migrate/vendor/backupmigrate/core/src/Source/MySQLiSource.php(139): mysqli->set_charset('utf8') #3 /var/www/d8/htdocs/modules/backup_migrate/vendor/backupmigrate/core/src/Source/MySQLiSource.php(47): BackupMigrate\Core\Source\MySQLiSource->_getConnection() #4 /var/www/d8/htdocs/modules/backup_migrate/vendor/backupmigrate/core/src/Main/BackupMigrate.php(93): BackupMigrate\Core\Source\MySQLiSource->exportToFile() #5 /var/www/d8/htdocs/modules/backup_migrate/backup_migrate.module(26): BackupMigrate\Core\Main\BackupMigrate->backup('default_db', 'download') #6 /var/www/d8/htdocs/modules/backup_migrate/src/Form/BackupMigrateQuickBackupForm.php(88): backup_migrate_perform_backup('default_db', 'download', Array) #7 [internal function]: Drupal\backup_migrate\Form\BackupMigrateQuickBackupForm->submitForm(Array, Object(Drupal\Core\Form\FormState)) #8 /var/www/d8/htdocs/core/lib/Drupal/Core/Form/FormSubmitter.php(111): call_user_func_array(Array, Array) #9 /var/www/d8/htdocs/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #10 /var/www/d8/htdocs/core/lib/Drupal/Core/Form/FormBuilder.php(585): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #11 /var/www/d8/htdocs/core/lib/Drupal/Core/Form/FormBuilder.php(314): Drupal\Core\Form\FormBuilder->processForm('backup_migrate_...', Array, Object(Drupal\Core\Form\FormState)) #12 /var/www/d8/htdocs/core/lib/Drupal/Core/Controller/FormController.php(74): Drupal\Core\Form\FormBuilder->buildForm('backup_migrate_...', Object(Drupal\Core\Form\FormState)) #13 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #14 /var/www/d8/htdocs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #15 /var/www/d8/htdocs/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #16 /var/www/d8/htdocs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #17 /var/www/d8/htdocs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #18 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #19 /var/www/d8/htdocs/vendor/symfony/http-kernel/HttpKernel.php(144): call_user_func_array(Object(Closure), Array) #20 /var/www/d8/htdocs/vendor/symfony/http-kernel/HttpKernel.php(64): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #21 /var/www/d8/htdocs/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /var/www/d8/htdocs/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /var/www/d8/htdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /var/www/d8/htdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /var/www/d8/htdocs/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /var/www/d8/htdocs/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /var/www/d8/htdocs/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /var/www/d8/htdocs/core/lib/Drupal/Core/DrupalKernel.php(652): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /var/www/d8/htdocs/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #30 {main}.

Another:
Warning: mysqli::__construct() expects parameter 5 to be integer, string given in BackupMigrate\Core\Source\MySQLiSource->_getConnection() (line 131 of /var/www/d8/htdocs/modules/backup_migrate/vendor/backupmigrate/core/src/Source/MySQLiSource.php) #0 /var/www/d8/htdocs/core/includes/bootstrap.inc(548): _drupal_error_handler_real(2, 'mysqli::__const...', '/var/www/d8.tek...', 131, Array) #1 [internal function]: _drupal_error_handler(2, 'mysqli::__const...', '/var/www/d8.tek...', 131, Array) #2 /var/www/d8/htdocs/modules/backup_migrate/vendor/backupmigrate/core/src/Source/MySQLiSource.php(131): mysqli->__construct('localhost', 'root', '_l33tPW', 'd8', '', NULL) #3 /var/www/d8/htdocs/modules/backup_migrate/vendor/backupmigrate/core/src/Source/MySQLiSource.php(47): BackupMigrate\Core\Source\MySQLiSource->_getConnection() #4 /var/www/d8/htdocs/modules/backup_migrate/vendor/backupmigrate/core/src/Main/BackupMigrate.php(93): BackupMigrate\Core\Source\MySQLiSource->exportToFile() #5 /var/www/d8/htdocs/modules/backup_migrate/backup_migrate.module(26): BackupMigrate\Core\Main\BackupMigrate->backup('default_db', 'download') #6 /var/www/d8/htdocs/modules/backup_migrate/src/Form/BackupMigrateQuickBackupForm.php(88): backup_migrate_perform_backup('default_db', 'download', Array) #7 [internal function]: Drupal\backup_migrate\Form\BackupMigrateQuickBackupForm->submitForm(Array, Object(Drupal\Core\Form\FormState)) #8 /var/www/d8/htdocs/core/lib/Drupal/Core/Form/FormSubmitter.php(111): call_user_func_array(Array, Array) #9 /var/www/d8/htdocs/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #10 /var/www/d8/htdocs/core/lib/Drupal/Core/Form/FormBuilder.php(585): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #11 /var/www/d8/htdocs/core/lib/Drupal/Core/Form/FormBuilder.php(314): Drupal\Core\Form\FormBuilder->processForm('backup_migrate_...', Array, Object(Drupal\Core\Form\FormState)) #12 /var/www/d8/htdocs/core/lib/Drupal/Core/Controller/FormController.php(74): Drupal\Core\Form\FormBuilder->buildForm('backup_migrate_...', Object(Drupal\Core\Form\FormState)) #13 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #14 /var/www/d8/htdocs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #15 /var/www/d8/htdocs/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #16 /var/www/d8/htdocs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #17 /var/www/d8/htdocs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #18 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #19 /var/www/d8/htdocs/vendor/symfony/http-kernel/HttpKernel.php(144): call_user_func_array(Object(Closure), Array) #20 /var/www/d8/htdocs/vendor/symfony/http-kernel/HttpKernel.php(64): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #21 /var/www/d8/htdocs/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /var/www/d8/htdocs/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /var/www/d8/htdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /var/www/d8/htdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /var/www/d8/htdocs/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /var/www/d8/htdocs/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /var/www/d8/htdocs/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /var/www/d8/htdocs/core/lib/Drupal/Core/DrupalKernel.php(652): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /var/www/d8/htdocs/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #30 {main}.

From settings.php

  'charset' => 'utf8mb4',
  'collation' => 'utf8mb4_general_ci',

From mysql

MariaDB [(none)]> SELECT @@character_set_database, @@collation_database;
+--------------------------+----------------------+
| @@character_set_database | @@collation_database |
+--------------------------+----------------------+
| utf8mb4                  | utf8mb4_general_ci   |
+--------------------------+----------------------+

d8 nginx php7.0-fpm mariadb

dev version, because alpha gives WSOD when backuping e.g. Entire site option. And with dev version can't even backup .sql

szeidler’s picture

The issue is related to Commit http://cgit.drupalcode.org/backup_migrate/commit/?id=995100e which came from https://www.drupal.org/node/2749885.

Can you check, if you have set a port for the database connection, because your log says it's an empty string?
When the database connection was not established successfully, the charset check might fail, so it would be good to have the Port issue fixed first.

vibrasphere’s picture

you mean in settings.php? no, because its default. the 3306. so i still need to set the default port?

btw the database is mariadb.

szeidler’s picture

I would at least give it a try, because the first warning looks like the mysqli connection is not established correctly.

yukare’s picture

I had this same issue, and i really think we need fix it. It is related to mysql port, you HAVE to set it to default, 3306, or any other you use, it can not be empty(''). Drupal works without any error if it is empty, but backup_migrate require it.
Maybe we can just set it to default somewere if it is not set in settings.php?

designcrs’s picture

Same problem here using drupalvm. Explicitly setting the mysql port to '3306' rather than '' in settings.php is a valid workaround.

couturier’s picture

There have been multiple reports about this problem, but one user reported as of January 31, 2017, that the January 1, 2017, 8.x-4.x-dev release had fixed the problem.

It is unclear whether the problem remains in the new 8.x-4.0-alpha2 released on April 4, 2017. The patch for this issue was reportedly not closed (fixed) until February 27, 2017, so the dates are confusing. Can anyone confirm that the problem has been solved in alpha 2? If so, we should close this issue.

benqwerty’s picture

@couturier, this particular issue i.e. getting the "UTF8 is not supported by the MySQL server" error when the port isn't set in settings.php still exists. I've just checked 8.x-4.0-alpha1+11-dev and 8.x-4.0-alpha2 and both give the error unless the port is set.

szeidler’s picture

Title: 'UTF8 is not supported by the MySQL server' » 'UTF8 is not supported by the MySQL server' - When database port was not set

Yes, basically backup_migrate creates a new database connection when starting the backup. That connection is using the sites database credentials. In Drupal Core, the database connection falls automatically back to 3306, whereas backup_migrate does not and tries to establish the connection with an empty string as port.

Currently the modules, doesn't check if the connection was established successfully. So a error is thrown for the first database operation, which is the set_charset() operation, which was introduced in https://www.drupal.org/node/2749885. So seems to be a false-positive error, because the error happened one step before.

The main question would be why the check before in http://cgit.drupalcode.org/backup_migrate/tree/vendor/backupmigrate/core... doesn't throw the exception:

if ($this->connection->connect_errno) {
  throw new \Exception("Failed to connect to MySQL server");
}

There might be different behaviors for empty strings on different PHP versions?

Anyhow, I think the safest way is to fallback on port 3306, when a empty string was provided. Because, that's what Core is doing too.

ronan’s picture

Anyhow, I think the safest way is to fallback on port 3306, when a empty string was provided. Because, that's what Core is doing too.

I agree. But I'd like to figure out why there isn't a more useful error being thrown before I suppress this one. Trying to reproduce this locally.

  • ronan committed 9d6685b on 8.x-4.x
    Issue #2851741 by vibrasphere: 'UTF8 is not supported by the MySQL...
ronan’s picture

Status: Active » Fixed

I have fixed this bug and improved the messaging for bad mysql connections

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.