Closed signal-intrusion closed 7 years ago
Changing to $config->getDbPort()
fixes the failing db connection check (https://github.com/craftcms/server-check/pull/2).
The Postgres error still occurs when attempting to register an email because the tables and columns are still not generated on the db.
ERROR: relation "sites" does not exist at character 70
STATEMENT: SELECT "id", "name", "handle", "language", "hasUrls", "baseUrl" FROM "sites" ORDER BY "sortOrder"
Fixed in https://github.com/craftcms/server-check/releases/tag/1.0.8.
The Postgres error still occurs when attempting to register an email because the tables and columns are still not generated on the db.
I can't reproduce this, though (the installer goes through fine). If it's still an issue for you please open up another issue.
I'm seeing this on a fresh craft3beta install (docker), https://github.com/wyveo/craftcms-docker/issues/5.
From the logs it looks like the installer is querying the db for the "sites"
table as soon as the install page is loaded?
2017-07-19 07:10:57 [10.0.1.4][-][-][info][yii\db\Connection::open] Opening DB connection: pgsql:host=postgres;dbname=craft3beta;port=5432;
2017-07-19 07:10:57 [10.0.1.4][-][-][profile begin][yii\db\Connection::open] Opening DB connection: pgsql:host=postgres;dbname=craft3beta;port=5432;
2017-07-19 07:10:57 [10.0.1.4][-][-][profile end][yii\db\Connection::open] Opening DB connection: pgsql:host=postgres;dbname=craft3beta;port=5432;
2017-07-19 07:10:57 [10.0.1.4][-][-][info][yii\db\Command::query] SELECT c.relname AS table_name
FROM pg_class c
INNER JOIN pg_namespace ns ON ns.oid = c.relnamespace
WHERE ns.nspname = 'public' AND c.relkind IN ('r','v','m','f')
ORDER BY c.relname
2017-07-19 07:10:57 [10.0.1.4][-][-][profile begin][yii\db\Command::query] SELECT c.relname AS table_name
FROM pg_class c
INNER JOIN pg_namespace ns ON ns.oid = c.relnamespace
WHERE ns.nspname = 'public' AND c.relkind IN ('r','v','m','f')
ORDER BY c.relname
2017-07-19 07:10:57 [10.0.1.4][-][-][profile end][yii\db\Command::query] SELECT c.relname AS table_name
FROM pg_class c
INNER JOIN pg_namespace ns ON ns.oid = c.relnamespace
WHERE ns.nspname = 'public' AND c.relkind IN ('r','v','m','f')
ORDER BY c.relname
2017-07-19 07:10:57 [10.0.1.4][-][-][info][yii\web\Session::open] Session started
2017-07-19 07:10:57 [10.0.1.4][-][-][profile begin][craft\web\View::renderTemplate] _special/install
2017-07-19 07:10:57 [10.0.1.4][-][-][profile begin][craft\web\twig\Environment::compileSource] _special/install
2017-07-19 07:10:57 [10.0.1.4][-][-][profile end][craft\web\twig\Environment::compileSource] _special/install
2017-07-19 07:10:57 [10.0.1.4][-][-][profile begin][craft\web\twig\Environment::compileSource] _layouts/basecp
2017-07-19 07:10:57 [10.0.1.4][-][-][profile end][craft\web\twig\Environment::compileSource] _layouts/basecp
2017-07-19 07:10:57 [10.0.1.4][-][-][profile begin][craft\web\twig\Environment::compileSource] _layouts/base
2017-07-19 07:10:57 [10.0.1.4][-][-][profile end][craft\web\twig\Environment::compileSource] _layouts/base
2017-07-19 07:10:57 [10.0.1.4][-][-][profile begin][craft\web\twig\Template::display] _special/install
2017-07-19 07:10:57 [10.0.1.4][-][-][info][yii\db\Command::query] SELECT "id", "name", "handle", "language", "hasUrls", "baseUrl"
FROM "sites"
ORDER BY "sortOrder"
2017-07-19 07:10:57 [10.0.1.4][-][-][profile begin][yii\db\Command::query] SELECT "id", "name", "handle", "language", "hasUrls", "baseUrl"
FROM "sites"
ORDER BY "sortOrder"
2017-07-19 07:10:57 [10.0.1.4][-][-][profile end][yii\db\Command::query] SELECT "id", "name", "handle", "language", "hasUrls", "baseUrl"
FROM "sites"
ORDER BY "sortOrder"
As you mentioned though this doesn't seem to cause any issues with the installer completing, and I don't see the error again once it does.
@colinwilson Similar error but this one is expected on fresh installs (and Craft will catch its exception). I just cleaned up the Sites service a bit to avoid them anyway, though. (9196dc175b045720c2b8ce0c174165cf510097b9)
Description
When attempting to install Craft with Postgres I get an error: "Can't connect to the database with the credentials supplied in db.php. Please double check them and try again." The credentials are correct. Postgres also logs an error:
If I create the
"sites"
table myself I get:So the problem is that Craft is attempting to query the db before the tables are set up.
So I dug deeper...
When Craft runs it's requirements checks it fails to connect to the Postgres DB. The default postgres port # is not being assigned to
RequirementsChecker->dbCreds['port']
right here: https://github.com/craftcms/server-check/blob/develop/server/requirements/RequirementsChecker.php#L408. When I examine thedbCreds['port']
it is an empty string.If I set
'port' => 5432
inconfig/db.php
everything works.Steps to reproduce
.env
<hostname>/admin
. It should show the "Can't connect error"'port' => 5432
to/config/db.php
. Refresh. It should continue the installation process.port
setting. Refresh. It doesn't work again.Additional info