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

problem with installation on Domain Factory #27

Closed
fritzmg opened this issue Sep 8, 2017 · 13 comments
Closed

problem with installation on Domain Factory #27

fritzmg opened this issue Sep 8, 2017 · 13 comments
Assignees
Labels
Milestone

Comments

@fritzmg
Copy link
Contributor

fritzmg commented Sep 8, 2017

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:

> 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

  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[HY000] [2054] Connecting to 3.22, 3.23 & 4.0 servers is not supported

  [PDOException]
  SQLSTATE[HY000] [2054] Connecting to 3.22, 3.23 & 4.0 servers is not supported

  [PDOException]
  PDO::__construct(): Connecting to 3.22, 3.23 & 4.0  is not supported. Server is 3.23.58-log


Script Contao\ManagerBundle\Composer\ScriptHandler::initializeApplication handling the post-install-cmd event terminated with an exception


  [RuntimeException]
  An error occurred while executing the "contao:install-web-dir" command:

    [Doctrine\DBAL\Exception\DriverException]
    An exception occured in driver: SQLSTATE[HY000] [2054] Connecting to 3.22, 3.23 & 4.0 servers is not supported

    [Doctrine\DBAL\Driver\PDOException]
    SQLSTATE[HY000] [2054] Connecting to 3.22, 3.23 & 4.0 servers is not supported

    [PDOException]
    SQLSTATE[HY000] [2054] Connecting to 3.22, 3.23 & 4.0 servers is not supported

    [PDOException]
    PDO::__construct(): Connecting to 3.22, 3.23 & 4.0  is not supported. Server is 3.23.58-log  

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.

@fritzmg
Copy link
Contributor Author

fritzmg commented Sep 8, 2017

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 contao/manager-bundle@06f1f29#diff-e3375107bffc209723fa127bb186d8c6 .

@leofeyer
Copy link
Member

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:

https://github.com/contao/manager-bundle/blob/30240eecaab46a86c3a1d040fbeede105ea443aa/src/ContaoManager/Plugin.php#L176

@fritzmg
Copy link
Contributor Author

fritzmg commented Sep 12, 2017

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.

@leofeyer
Copy link
Member

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

😧

@fritzmg
Copy link
Contributor Author

fritzmg commented Sep 12, 2017

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?).

@fritzmg
Copy link
Contributor Author

fritzmg commented Sep 12, 2017

😧

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.

@leofeyer
Copy link
Member

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?).

This should be fixed.

@leofeyer
Copy link
Member

@fritzmg
Copy link
Contributor Author

fritzmg commented Sep 15, 2017

@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)?

@leofeyer
Copy link
Member

What exactly are you referring to?

@fritzmg
Copy link
Contributor Author

fritzmg commented Sep 16, 2017

What exactly are you referring to?

contao/installation-bundle#54

@leofeyer
Copy link
Member

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

@fritzmg
Copy link
Contributor Author

fritzmg commented Sep 16, 2017

Ah I see, I missed that, sorry.

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

No branches or pull requests

2 participants