Problem with CLI in CodeIgniter

1

I'm trying to run CLI by following the documentation but it throws me errors and there's no way.

I am located in the main root of my project, one empty with a couple of methods in welcome.php and connection to a database.

The minimum previous configuration I have is:

$autoload['libraries'] = array('database');

$config['uri_protocol'] = isset($_SERVER['REQUEST_URI']) ? 'PATH_INFO' : 'CLI';

Function that I call:

public function test_country($country)
{
    $this->load->library('unit_test');
    $actual = $country;
    $expected = 'Japan';
    $name = 'Existe pais recibido';
    $this->unit->run($actual, $expected, $name);
    echo $this->unit->report().PHP_EOL;
    die();
}
    
asked by dddenis 19.10.2016 в 09:59
source

1 answer

1

It is clear that you have a bad configuration of your database. You can try

Change from

$autoload['libraries'] = array('database');

a

$autoload['libraries'] = array('');

And if you need the database, check the database.php file to see that it has the correct configuration.

"Unable to connect to a database using the provided settings."

Appears for that same reason.

Your solutions are as I said before: 1: disable the database autoload (so that it does not connect on all screens to the database and you can use the cli). 2: Connect it to a correct database, for that you would have to put the data from your database.php to see if that has an error.

    
answered by 11.11.2016 в 18:30