Closed toddpadwick closed 3 years ago
@toddpadwick it appears that you are running php
from your host machine?
Can you verify your .env file is pointing to the <db>.database.nitro
and has the right credentials?
We also tagged a few releases since beta 7 with some bug fixes :)
Yes it is. I can create entries and make changes in the admin which means the creds must be correct, no? I just can't install plugins.
Done some more tests - I updated to the latest version, and I also tried switching back to my old set up (MAMP) and that worked fine. So I can confirm there is an issue with Nitro not allowing db connections to php plugin installs. Despite edits to the admin and adding entries etc working fine.
Hmmm, I’ve seen this before. With MAMP shut down can you double check your environment file and also clear your caches?
@toddpadwick is there a chance the db credentials were cached and MAMP was still running? Also what OS are you running where you are seeing this issue?
Hi @jasonmccallister i am on Mac Catalina 10.15.7.
I have also updated to Nitro 2.0.5.
I haven't run MAMP in a few days now and have cleared the craft Cache in the admin. I have also tried clearing the composer's cache. But I still can't install or update composer plugins in the command line. As before, I have no problem accessing the craft admin and saving entries however, which confirms the DB creds in db.php must be correct.
I've also been noticing some weird issues where project yaml alert pops up out of nowhere to ask me to apply changes. when I do this, it seems to revert changes I literally just made minutes before in the very same admin. So there may also be some issues with timestamping yaml files maybe?
I have also noticed that plugins I have removed via the admin are being removed from the composer files, but their settings remain in project yaml. So when I go to deploy to a server, I get the error Your project yaml files are expecting Xxxxx plugin to be installed, try running composer install first
. I assume this is also related to the same issue above.
Hi @jasonmccallister I have updated to latest versions and am still getting this problem - i cant update craft with Nitro set up. But I can browse the admin, edit and save entries etc. Despite clearly having successful connection to db via admin, anything via the terminal does not:
Craft can’t connect to the database. Check your connection settings.
Fetching available updates ... Exception 'craft\errors\DbConnectException' with message 'Craft CMS can’t connect to the database with the credentials in config/db.php.'
in /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/craftcms/cms/src/db/Connection.php:173
Caused by: Exception 'yii\db\Exception' with message 'SQLSTATE[HY000] [2002] Connection refused'
in /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/db/Connection.php:642
Caused by: Exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Connection refused'
in /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/db/Connection.php:712
Stack trace:
#0 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/db/Connection.php(712): PDO->__construct('mysql:host=mysq...', 'nitro', 'nitro', Array)
#1 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/db/Connection.php(631): yii\db\Connection->createPdoInstance()
#2 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/craftcms/cms/src/db/Connection.php(152): yii\db\Connection->open()
#3 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/db/Connection.php(1032): craft\db\Connection->open()
#4 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/db/Connection.php(1019): yii\db\Connection->getMasterPdo()
#5 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/db/Schema.php(700): yii\db\Connection->getSlavePdo()
#6 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/craftcms/cms/src/helpers/Api.php(114): yii\db\Schema->getServerVersion()
#7 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/craftcms/cms/src/helpers/Api.php(39): craft\helpers\Api::platformVersions()
#8 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/craftcms/cms/src/services/Api.php(121): craft\helpers\Api::headers()
#9 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/craftcms/cms/src/services/Api.php(85): craft\services\Api->request('GET', 'updates', Array)
#10 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/craftcms/cms/src/console/controllers/UpdateController.php(615): craft\services\Api->getUpdates(Array)
#11 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/craftcms/cms/src/console/controllers/UpdateController.php(258): craft\console\controllers\UpdateController->_getUpdates(Array)
#12 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/craftcms/cms/src/console/controllers/UpdateController.php(162): craft\console\controllers\UpdateController->_getRequirements('all')
#13 [internal function]: craft\console\controllers\UpdateController->actionUpdate('all')
#14 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#15 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#16 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/console/Controller.php(184): yii\base\Controller->runAction('', Array)
#17 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/craftcms/cms/src/console/Controller.php(192): yii\console\Controller->runAction('', Array)
#18 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/base/Module.php(534): craft\console\Controller->runAction('', Array)
#19 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/console/Application.php(181): yii\base\Module->runAction('update', Array)
#20 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/craftcms/cms/src/console/Application.php(89): yii\console\Application->runAction('update', Array)
#21 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/console/Application.php(148): craft\console\Application->runAction('update', Array)
#22 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/vendor/yiisoft/yii2/base/Application.php(392): yii\console\Application->handleRequest(Object(craft\console\Request))
#23 /Users/toddpadwick/Sites/functionandform/api/ffd-api-v1/craft(22): yii\base\Application->run()
#24 {main}
@toddpadwick are you running the craft
command outside of the container and on your host mahcine? The path contains your /Users directory which does not exist in the container.
Closing this issue out, if this is still a problem please let us know by filing a new issue! Thank you!
Hi @jasonmccallister it is still an issue but I've switched back to MAMP for some sites for the time being.
Description
I can navigate the admin fine so craft is certainly accessing the database for some tasks. But when I try installing plugins both in the admin and in the terminal I get the following error:
Steps to reproduce
Additional info