Doug Wolfgram
Doug Wolfgram

Reputation: 2126

What causes this 'index not found' error in CodeIgniter 3

I have an app that seems to run fine, but my logs get a few lines like this each day...

ERROR - 2015-07-30 12:19:07 --> Severity: Notice --> Undefined index: HTTP_HOST /application/config/database.php 67
ERROR - 2015-07-30 12:19:07 --> Severity: Notice --> Undefined index: HTTP_HOST /application/config/database.php 68
ERROR - 2015-07-30 12:19:07 --> Severity: Notice --> Undefined index: HTTP_HOST /application/config/database.php 69
ERROR - 2015-07-30 12:19:07 --> Severity: Notice --> Undefined index: HTTP_HOST /application/controllers/Inc.php 15

As I said, the app seems to be running properly but I depend on using $_SERVER['HTTP_HOST'] to ensure proper execution. Is this a known issue with CodeIgniter 3? Especially the database config. I use different databases depending on which instance I am on.

Thanks for any advice.

Upvotes: 1

Views: 146

Answers (1)

Hannan
Hannan

Reputation: 514

instead of $_SERVER['HTTP_HOST'] you can try using $_SERVER['SERVER_NAME'] The problem is that your server is not sending HTTP_HOST into $_SERVER global variable. This is case many times which varies from server to server

Upvotes: 1

Related Questions