Running Codeigniter via CLI outputs website root instead of expected result Running Codeigniter via CLI outputs website root instead of expected result codeigniter codeigniter

Running Codeigniter via CLI outputs website root instead of expected result


try this:

php index.php/controller/function/param1/param2/param3 etc

or

php index.php controller function param1 param2 param3 etc

also, post the content of your $_SERVER var and value of the 'uri_protocol' variable from config.php.

$config['uri_protocol'] should be 'AUTO'


For me this was resolved by changing:

$config['uri_protocol'] = 'AUTO' 

in the main config file.

I had previously changed it to

'REQUEST_URI'

which doesn't work with CLI apparently.


The output I get is the index page HTML source, e.g. http://localhost/code.

You have got an error with your routing, your new example CLI controller is not fired, but another controller. Which error you have with your routing is hard to say, as you have not shown your whole code.