Closed fritzmg closed 7 years ago
Full stack traces:
> post-install-cmd: Contao\ManagerBundle\Composer\ScriptHandler::initializeApplication
[Doctrine\DBAL\Exception\DriverException]
An exception occured in driver: SQLSTATE[HY000] [2054] Connecting to 3.22,
3.23 & 4.0 servers is not supported
Exception trace:
() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:115
Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:145
Doctrine\DBAL\DBALException::driverException() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:47
Doctrine\DBAL\Driver\PDOMySql\Driver->connect() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360
Doctrine\DBAL\Connection->connect() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/contao/manager-bundle/src/ContaoManager/Plugin.php:169
Contao\ManagerBundle\ContaoManager\Plugin->getExtensionConfig() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/contao/manager-plugin/src/Config/ContainerBuilder.php:65
Contao\ManagerPlugin\Config\ContainerBuilder->getExtensionConfig() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php:34
Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass->process() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:143
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:746
Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:577
Symfony\Component\HttpKernel\Kernel->initializeContainer() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/contao/manager-bundle/src/HttpKernel/ContaoKernel.php:213
Contao\ManagerBundle\HttpKernel\ContaoKernel->initializeContainer() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:119
Symfony\Component\HttpKernel\Kernel->boot() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:69
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:125
Symfony\Component\Console\Application->run() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/contao/manager-bundle/bin/contao-console:44
[Doctrine\DBAL\Driver\PDOException (2054)]
SQLSTATE[HY000] [2054] Connecting to 3.22, 3.23 & 4.0 servers is not suppor
ted
Exception trace:
() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:47
Doctrine\DBAL\Driver\PDOConnection->__construct() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:44
Doctrine\DBAL\Driver\PDOMySql\Driver->connect() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360
Doctrine\DBAL\Connection->connect() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/contao/manager-bundle/src/ContaoManager/Plugin.php:169
Contao\ManagerBundle\ContaoManager\Plugin->getExtensionConfig() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/contao/manager-plugin/src/Config/ContainerBuilder.php:65
Contao\ManagerPlugin\Config\ContainerBuilder->getExtensionConfig() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php:34
Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass->process() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:143
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:746
Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:577
Symfony\Component\HttpKernel\Kernel->initializeContainer() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/contao/manager-bundle/src/HttpKernel/ContaoKernel.php:213
Contao\ManagerBundle\HttpKernel\ContaoKernel->initializeContainer() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:119
Symfony\Component\HttpKernel\Kernel->boot() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:69
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:125
Symfony\Component\Console\Application->run() at /kunden/xxx/htdocs/projektfolder/contao/v44x/me/vendor/contao/manager-bundle/bin/contao-console:44
The problem is actually that the manager-bundle only catches Doctrine\DBAL\Exception\ConnectionException
here during the MySQL connection test: https://github.com/contao/manager-bundle/blob/4.4.4/src/ContaoManager/Plugin.php#L171 .
So this problem was probably introduced in Contao 4.4.0(-RC2) with https://github.com/contao/manager-bundle/commit/06f1f294bedcbe456869145597de0dfa32f352aa#diff-e3375107bffc209723fa127bb186d8c6 .
As we know, Doctrine (unfortunately) always tries to make a connection to a MySQL server no matter what when initialized
This is not true. If you set dbal.connections.default.server_version
, there will be no connection attempt. And we are already doing this:
Yeah the problem seems to be the manager-bundle's own connection test. It connects to the localhost
(since at this point no database has been configured yet), but on Domain Factory, localhost
is an old MySQL 3 server, which leads to the aforementioned exceptions.
Yeah the problem seems to be the manager-bundle's own connection test.
Can you point me to the code please?
but on Domain Factory,
localhost
is an old MySQL 3 server
:anguished:
See my second comment. The exception occurs here: https://github.com/contao/manager-bundle/blob/4.4.4/src/ContaoManager/Plugin.php#L167-L181
This connection test only catches as Doctrine\DBAL\Exception\ConnectionException
. However, if the localhost
is an old MySQL 3 server, it throws a Doctrine\DBAL\Exception\DriverException
(and a Doctrine\DBAL\Driver\PDOException
?).
😧
It's fine, they still provide MySQL 5 servers, but with mysql5.example.org
as the host name ;). But yeah... it's stupid that the default localhost
one is MySQL 3 ... probably for legacy reasons.
This connection test only catches as
Doctrine\DBAL\Exception\ConnectionException
. However, if thelocalhost
is an old MySQL 3 server, it throws aDoctrine\DBAL\Exception\DriverException
(and aDoctrine\DBAL\Driver\PDOException
?).
This should be fixed.
Fixed in contao/manager-bundle@9a14ef8a0b41f25745a6862b28d46e3fee21ae80 and contao/core-bundle@2eb52f30b0e297023cc11f8e4fa9b624fcb81e25.
@leofeyer wouldn't this change not catch the connection exception that would occur on servers where anyonymous users are allowed (or not allowed... don't remember for which case this was done)?
What exactly are you referring to?
What exactly are you referring to?
The connection exception is a subclass of the driver exception:
https://github.com/doctrine/dbal/blob/2.5/lib/Doctrine/DBAL/Exception/ConnectionException.php#L29
Ah I see, I missed that, sorry.
In the Managed Edition, the database credentials are created by the Contao Install Tool. This leads to a problem on Domain Factory if you are using the Contao Manager for installation (presumably) or
composer create-project
during the post-install/update-cmds:As we know, Doctrine (unfortunately) always tries to make a connection to a MySQL server no matter what when initialized, even if the database credentials haven't been defined yet. It uses its default values, which includes
localhost
as the hostname for the MySQL server.This is a problem on Domain Factory, because the MySQL server that is reachable under
localhost
is of version 3 ... See https://www.df.eu/at/support/df-faq/webhosting/datenbanken/mysql-datenbanken/The MySQL 5.x server is behind
mysql5.example.org
.