codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.35k stars 1.9k forks source link

Bug PHP SPARK MIGRATE #4101

Closed hafidz06 closed 3 years ago

hafidz06 commented 3 years ago

D:\xampp\htdocs\login>php spark migrate -all

CodeIgniter CLI Tool - Version 4.0.4 - Server-Time: 2021-01-14 08:45:46am

Running all new migrations... An uncaught Exception was encountered

Type: CodeIgniter\Database\Exceptions\DatabaseException Message: Unable to connect to the database. Filename: D:\xampp\htdocs\login\vendor\codeigniter4\framework\system\Database\BaseConnection.php Line Number: 425

    Backtrace:
                                            -646 - D:\xampp\htdocs\login\vendor\codeigniter4\framework\system\Database\BaseConnection.php::initialize
                                                            -1548 - D:\xampp\htdocs\login\vendor\codeigniter4\framework\system\Database\BaseConnection.php::query
                                                            -1591 - D:\xampp\htdocs\login\vendor\codeigniter4\framework\system\Database\BaseConnection.php::listTables
                                                            -945 - D:\xampp\htdocs\login\vendor\codeigniter4\framework\system\Database\MigrationRunner.php::tableExists
                                                            -193 - D:\xampp\htdocs\login\vendor\codeigniter4\framework\system\Database\MigrationRunner.php::ensureTable
                                                            -128 - D:\xampp\htdocs\login\vendor\codeigniter4\framework\system\Commands\Database\Migrate.php::latest
                                                            -100 - D:\xampp\htdocs\login\vendor\codeigniter4\framework\system\CLI\Commands.php::run
                                                            -107 - D:\xampp\htdocs\login\vendor\codeigniter4\framework\system\CLI\CommandRunner.php::run
                                                            -85 - D:\xampp\htdocs\login\vendor\codeigniter4\framework\system\CLI\CommandRunner.php::index
                                                            -914 - D:\xampp\htdocs\login\vendor\codeigniter4\framework\system\CodeIgniter.php::_remap
                                                            -404 - D:\xampp\htdocs\login\vendor\codeigniter4\framework\system\CodeIgniter.php::runController

Context

paulbalandan commented 3 years ago

Set the $threshold property of app/Config/Logger.php to 4 so DB errors can also be logged. Run php spark migrate -all again and kindly look at your logs at writable/logs/. Tell us the error posted.

MGatner commented 3 years ago

In the past this has usually been caused by missing extensions for php-cli. Run php -I and make sure you meet the server requirements, then follow Paul's troubleshooting steps above.

paulbalandan commented 3 years ago

More often than not, this is not a framework issue but a misconfiguration in the development/production server, like missing php extensions and wrong configs. Closing this, but continue the conversation if you have new info available.