Advertisement:

Author Topic: PHP Notice: Undefined index: HTTP_HOST (config.php)  (Read 2309 times)

jerry singh

  • Newbie
  • *
  • Posts: 25
PHP Notice: Undefined index: HTTP_HOST (config.php)
« on: December 24, 2017, 07:13:50 pm »
hi,
a new error encounter,

config.php

PHP Notice:  Undefined index: HTTP_HOST

i have implemented,

if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
code 1....
} else {
code 2....
}

now getting less no of error per day,  2 or 3 in error.log

i guess this error is generating due to cron-   php cli  & ssl


am now degrade my php version -  from 7.2 to 7.0

php 7.0

am using hsts, but this error is encounter since many days.

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: PHP Notice: Undefined index: HTTP_HOST (config.php)
« Reply #1 on: December 24, 2017, 07:30:47 pm »
This is fixed in Osclass core since some time, unless it is unrelated.

More details please, exact line, version of Osclass.

Osclass config.php does not use HTTP_HOST, unless you added some code.
« Last Edit: December 24, 2017, 07:33:08 pm by dev101 »

Aficionado

  • Guest
Re: PHP Notice: Undefined index: HTTP_HOST (config.php)
« Reply #2 on: December 24, 2017, 08:03:25 pm »
This is not an error.

Error <> Notice.

Also as dev101 said, i see no http_host in my config.php

jerry singh

  • Newbie
  • *
  • Posts: 25
Re: PHP Notice: Undefined index: HTTP_HOST (config.php)
« Reply #3 on: December 26, 2017, 05:27:01 pm »
@Aficionado

recall http_host is for subdomain,

theres lot of error/notice generates in error.log

Aficionado

  • Guest
Re: PHP Notice: Undefined index: HTTP_HOST (config.php)
« Reply #4 on: December 26, 2017, 05:29:33 pm »
@Aficionado

recall http_host is for subdomain,

theres lot of error/notice generates in error.log

No such code exists in config.php for Osclass. What do you mean ? Where did you find that code ?


jerry singh

  • Newbie
  • *
  • Posts: 25
Re: PHP Notice: Undefined index: HTTP_HOST (config.php)
« Reply #5 on: December 26, 2017, 05:34:52 pm »
is there any option to pm you,

take a look- :)
https://forums.osclass.org/3-5-x/steps-for-setting-up-the-sub-domain-feature/

now its look better, check it out.
« Last Edit: December 26, 2017, 05:37:53 pm by jerry singh »

Aficionado

  • Guest
Re: PHP Notice: Undefined index: HTTP_HOST (config.php)
« Reply #6 on: December 26, 2017, 05:36:13 pm »
is there any option to pm you,

take a look- :)
https://market.osclass.org/search/user,1/iPage,2

No PM is disabled for me also. Explain what you mean with that Market link, i don't understand.


Aficionado

  • Guest
Re: PHP Notice: Undefined index: HTTP_HOST (config.php)
« Reply #8 on: December 26, 2017, 05:44:06 pm »
check it out https://forums.osclass.org/3-5-x/steps-for-setting-up-the-sub-domain-feature/

Anyway, still not clear what you mean or want to do.

As i told you, unless you are just testing for pure curiocsity 7.2, use 7.0.x

jerry singh

  • Newbie
  • *
  • Posts: 25
Re: PHP Notice: Undefined index: HTTP_HOST (config.php)
« Reply #9 on: December 26, 2017, 05:47:54 pm »
am using 7.0 version 3.7.4. + ssl,



if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {

define('WEB_PATH', 'https://'.$_SERVER['HTTP_HOST'].'/');     (line 29)
} else {
define('WEB_PATH', 'http://'.$_SERVER['HTTP_HOST'].'/');    (line 31)

}


PHP Notice:  Undefined index: HTTP_HOST in /home/xxxxx/public_html/config.php on line 29
PHP Notice:  Undefined index: HTTP_HOST in /home/xxxxx/public_html/config.php on line 31


as far as i know, (pls correct me if am wrong),
 if i wrote $_SERVER[HTTP_HOST] instead of $_SERVER['HTTP_HOST'], then this issue should arise, but heres no reason for this issue arrising. ???







« Last Edit: December 26, 2017, 06:10:49 pm by jerry singh »