# |
Jan 8th 2020, 16:33 |
slackebot |
Installing wyrihaximus/twig-view (4.3.8): Downloading (100%) - Installing cakephp/bake (1.12.0): Downloading (100%) - Installing squizlabs/php_codesniffer (3.5.3): Downloading (100%) - Installing cakephp/cakephp-codesniffer (3.3.0): Downloading (100%) - Installing jdorn/sql-formatter (v1.2.17): Downloading (100%) - Installing symfony/process (v4.4.2): Downloading (100%) - Installing |
# |
Jan 8th 2020, 16:33 |
slackebot |
Installing symfony/polyfill-php73 (v1.13.1): Downloading (100%) - Installing symfony/polyfill-mbstring (v1.13.1): Downloading (100%) - Installing symfony/console (v4.4.2): Downloading (100%) - Installing robmorgan/phinx (0.11.4): Downloading (100%) - Installing cakephp/migrations (2.4.1): Downloading (100%) - Installing mobiledetect/mobiledetectlib (2.8.34): Downloading (100%) - |
# |
Jan 8th 2020, 16:33 |
slackebot |
(100%) - Installing symfony/polyfill-ctype (v1.13.1): Downloading (100%) - Installing symfony/yaml (v5.0.2): Downloading (100%) - Installing symfony/filesystem (v4.4.2): Downloading (100%) - Installing symfony/config (v5.0.2): Downloading (100%) - Installing psr/container (1.0.0): Downloading (100%) - Installing symfony/service-contracts (v2.0.1): Downloading (100%) - |
# |
Jan 8th 2020, 16:33 |
slackebot |
Installing aura/intl (3.0.0): Downloading (100%) - Installing psr/http-message (1.0.1): Downloading (100%) - Installing zendframework/zend-diactoros (1.8.7): Downloading (100%) - Installing psr/simple-cache (1.0.1): Downloading (100%) - Installing psr/log (1.1.2): Downloading (100%) - Installing cakephp/chronos (1.3.0): Downloading (100%) - Installing cakephp/cakephp (3.8.8): Downloading |
# |
Jan 8th 2020, 16:33 |
wizardfix |
```00:18: htdocs $ php composer.phar create-project cakephp/app trportal 3.8 Installing cakephp/app (3.8.0) - Installing cakephp/app (3.8.0): Downloading (100%) Created project in trportal Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 78 installs, 0 updates, 0 removals - Installing cakephp/plugin-installer (1.2.0): Downloading (100%) - |
# |
Jan 8th 2020, 16:33 |
wizardfix |
Created with composer |
# |
Jan 8th 2020, 16:33 |
ckjksl |
but if you're missing files, that seems to be another problem |
# |
Jan 8th 2020, 16:32 |
ckjksl |
https://book.cakephp.org/3/en/orm/database-basics.html#database-configuration |
# |
Jan 8th 2020, 16:32 |
wizardfix |
So can I get the DSN from phpMyAdmin or where? The database is working fine in CakePHP, CRUD ops are performed correctly etc., it's just with Bake I'm getting these errors... :thinking_face: |
# |
Jan 8th 2020, 16:31 |
ckjksl |
Can you go through the steps of how you manually created this project? |
# |
Jan 8th 2020, 16:30 |
wizardfix |
Now I get ```Exception: SQLSTATE[HY000] [2002] No such file or directory in [/opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Database/Driver.php, line 92]``` |
# |
Jan 8th 2020, 16:30 |
ckjksl |
No, i don't think you need to unset it, I think you need to configure it |
# |
Jan 8th 2020, 16:29 |
wizardfix |
Yeah mine has that too, and I have now unset DATABASE_URL. |
# |
Jan 8th 2020, 16:27 |
ckjksl |
my database config definitely has ```'url' => env('DATABASE_URL', null),``` |
# |
Jan 8th 2020, 16:26 |
wizardfix |
I assume Bake must have looked to see if there was an environment variable `DATABASE_URL`, and it found one... |
# |
Jan 8th 2020, 16:26 |
ndm |
Or set the proper DSN |
# |
Jan 8th 2020, 16:26 |
ndm |
CakePHP doesn't seem to ignore empty variables, so you shouldn't set the env variable at all if you're not using it. |
# |
Jan 8th 2020, 16:25 |
slackebot |
~~how is a past Python project interfering with your Cake project~~ how did you manually create this project? :thinking_face: |
# |
Jan 8th 2020, 16:25 |
slackebot |
Command sent from Slack by ckjksl: |
# |
Jan 8th 2020, 16:25 |
wizardfix |
I am getting this errors also in the manually created project, which works as a project, if I try to use `bake`. |
# |
Jan 8th 2020, 16:24 |
wizardfix |
Oh, I had it set from a past Python project - I had reset it to '' now |
# |
Jan 8th 2020, 16:23 |
ckjksl |
how is the `DATABASE_URL` being set to `db.sqlite3`? |
# |
Jan 8th 2020, 16:19 |
slackebot |
/opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Console/CommandRunner.php(162): Cake\Console\CommandRunner->runShell(Object(Bake\Shell\BakeShell), Array) #13 /opt/lampp/htdocs/myprojects/bin/cake.php(12): Cake\Console\CommandRunner->run(Array) #14 {main}``` |
# |
Jan 8th 2020, 16:19 |
slackebot |
/opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/BakeShell.php(283): Cake\Collection\Collection->each(Object(Closure)) #10 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Console/Shell.php(517): Bake\Shell\BakeShell->all('users') #11 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Console/CommandRunner.php(385): Cake\Console\Shell->runCommand(Array, true) #12 |
# |
Jan 8th 2020, 16:19 |
slackebot |
/opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(101): Bake\Shell\Task\ModelTask->bake('Users') #7 /opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/BakeShell.php(282): Bake\Shell\Task\ModelTask->main('Users') #8 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Collection/CollectionTrait.php(64): Bake\Shell\BakeShell->Bake\Shell\{closure}('Users', 0) #9 |
# |
Jan 8th 2020, 16:19 |
slackebot |
/opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Datasource/ConnectionManager.php(204): Cake\Core\ObjectRegistry->load('Cake\\Database\\C...', Array) #4 /opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(196): Cake\Datasource\ConnectionManager::get('default') #5 /opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(113): Bake\Shell\Task\ModelTask->getTableObject('Users', 'users') #6 |
# |
Jan 8th 2020, 16:19 |
slackebot |
/opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Database/Connection.php(119): Cake\Database\Connection->setDriver('', Array) #1 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Datasource/ConnectionRegistry.php(88): Cake\Database\Connection->__construct(Array) #2 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Core/ObjectRegistry.php(96): Cake\Datasource\ConnectionRegistry->_create('Cake\\Database\\C...', 'default', Array) #3 |
# |
Jan 8th 2020, 16:19 |
slackebot |
found. in [/opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Database/Connection.php, line 173] 2020-01-08 16:14:58 Error: [Cake\Database\Exception\MissingDriverException] Database driver could not be found. in /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Database/Connection.php on line 173 Exception Attributes: array ( 'driver' => '', ) Stack Trace: #0 |
# |
Jan 8th 2020, 16:19 |
wizardfix |
and I discovered I had `DATABASE_URL` set as an environment variable to `db.sqlite3`, so I set this to null string but now get other errors: ```myprojects $ ./bin/cake bake all users Notice Error: Undefined index: className in [/opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Datasource/ConnectionManager.php, line 116] Bake All --------------------------------------------------------------- Exception: Database driver could not be |
# |
Jan 8th 2020, 16:19 |
ckjksl |
That's pretty close :+1: did you scan your files to see if there were any lines involving sqlite? |
# |
Jan 8th 2020, 16:17 |
wizardfix |
@ckjksl not quite: it's ```Datasources' => [ 'default' => [ 'className' => Connection::class, 'driver' => Mysql::class, 'persistent' => false, 'host' => 'localhost',``` |
# |
Jan 8th 2020, 16:16 |
ckjksl |
so make sure your `className` and `driver` are using Mysql |
# |
Jan 8th 2020, 16:15 |
ckjksl |
I think `bake` uses your default database connection by er, default |
# |
Jan 8th 2020, 16:14 |
ckjksl |
in your `app.php`, does your database definition look like this: ```Datasources' => [ 'default' => [ 'className' => 'Cake\Database\Connection', 'driver' => 'Cake\Database\Driver\Mysql', 'persistent' => false, 'host' => 'localhost', ...``` |
# |
Jan 8th 2020, 15:42 |
slackebot |
/opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Console/CommandRunner.php(385): Cake\Console\Shell->runCommand(Array, true) #18 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Console/CommandRunner.php(162): Cake\Console\CommandRunner->runShell(Object(Bake\Shell\BakeShell), Array) #19 /opt/lampp/htdocs/myprojects/bin/cake.php(12): Cake\Console\CommandRunner->run(Array) #20 {main}``` Can anyone advise please? :thinking_face: |
# |
Jan 8th 2020, 15:42 |
slackebot |
Bake\Shell\Task\ModelTask->main('Users') #14 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Collection/CollectionTrait.php(64): Bake\Shell\BakeShell->Bake\Shell\{closure}('Users', 0) #15 /opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/BakeShell.php(283): Cake\Collection\Collection->each(Object(Closure)) #16 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Console/Shell.php(517): Bake\Shell\BakeShell->all('users') #17 |
# |
Jan 8th 2020, 15:42 |
slackebot |
Bake\Shell\Task\ModelTask->getAssociations(Object(Cake\ORM\Table)) #11 /opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(114): Bake\Shell\Task\ModelTask->getTableContext(Object(Cake\ORM\Table), 'users', 'Users') #12 /opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(101): Bake\Shell\Task\ModelTask->bake('Users') #13 /opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/BakeShell.php(282): |
# |
Jan 8th 2020, 15:42 |
slackebot |
Cake\Database\Connection->getSchemaCollection() #8 /opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(1050): Bake\Shell\Task\ModelTask->_getAllTables() #9 /opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(213): Bake\Shell\Task\ModelTask->listAll() #10 /opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(131): |
# |
Jan 8th 2020, 15:42 |
slackebot |
/opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Database/Schema/CachedCollection.php(41): Cake\Database\Schema\Collection->__construct(Object(Cake\Database\Connection)) #6 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Database/Connection.php(390): Cake\Database\Schema\CachedCollection->__construct(Object(Cake\Database\Connection), true) #7 /opt/lampp/htdocs/myprojects/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(1096): |
# |
Jan 8th 2020, 15:42 |
slackebot |
/opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Database/Schema/BaseSchema.php(44): Cake\Database\Driver\Mysql->connect() #3 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Database/Dialect/MysqlDialectTrait.php(62): Cake\Database\Schema\BaseSchema->__construct(Object(Cake\Database\Driver\Mysql)) #4 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Database/Schema/Collection.php(51): Cake\Database\Driver\Mysql->schemaDialect() #5 |
# |
Jan 8th 2020, 15:42 |
slackebot |
/opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Database/Driver.php on line 92 Stack Trace: #0 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Database/Driver.php(92): PDO->__construct('mysql:host=loca...', 'root', 'tapir73', Array) #1 /opt/lampp/htdocs/myprojects/vendor/cakephp/cakephp/src/Database/Driver/Mysql.php(105): Cake\Database\Driver->_connect('mysql:host=loca...', Array) #2 |