Un utilisateur a demandé 👇
Salut, j’ai beaucoup lu sur cet avertissement php que nous recevons souvent dans le fichier debug.log :
PHP Notice: Undefined index HTTP_HOST
Dans les autres messages du forum, le problème est toujours lié à un plugin spécifique, mais dans ce cas, je voudrais souligner que ces avertissements sont également liés au noyau wordpress.
Voici un exemple des avertissements que j’ai reçus chaque jour dans le fichier debug.log. Pour recueillir plus d’informations sur la demande, j’ai suivi le $_SERVER
variables, mais je ne comprends pas pourquoi wordpress lance ces avertissements. (Suppression du véritable chemin du serveur, du dossier et de l’URI NB).
[20-Jul-2020 07:26:19 UTC] Array
(
[SERVER_SOFTWARE] => Apache
[REQUEST_URI] => /
[PHP_INI_SCAN_DIR] =>
[PATH] => /usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/opt/bin
[PWD] => /usr/local/cpanel/cgi-sys
[TZ] => Europe/Rome
[SHLVL] => 0
[MAGICK_THREAD_LIMIT] => 1
[PHP_FCGI_MAX_REQUESTS] => 150000
[HTTP_CONNECTION] => close
[SCRIPT_NAME] => /index.php
[QUERY_STRING] =>
[REQUEST_METHOD] => GET
[SERVER_PROTOCOL] => HTTP/1.0
[GATEWAY_INTERFACE] => CGI/1.1
[REMOTE_PORT] => 64315
[SCRIPT_FILENAME] => /home/xxxx/public_html/index.php
[SERVER_ADMIN] => [email protected]
[CONTEXT_DOCUMENT_ROOT] => /home/myfolder/public_html
[CONTEXT_PREFIX] =>
[REQUEST_SCHEME] => http
[DOCUMENT_ROOT] => /home/myfolder/public_html
[REMOTE_ADDR] => 45.76.157.210
[SERVER_PORT] => 80
[SERVER_ADDR] => my server ip address
[SERVER_NAME] => my server name
[SERVER_SIGNATURE] =>
[SCRIPT_URI] => my server uri
[SCRIPT_URL] => /
[UNIQUE_ID] => [email protected]
[FCGI_ROLE] => RESPONDER
[PHP_SELF] => /index.php
[REQUEST_TIME_FLOAT] => 1595229979.61
[REQUEST_TIME] => 1595229979
[argv] => Array
(
)
[argc] => 0
)
[20-Jul-2020 07:26:19 UTC] PHP Notice: Undefined index: HTTP_HOST in /home/myfolder/public_html/wp-includes/ms-settings.php on line 57
[20-Jul-2020 07:26:20 UTC] PHP Notice: Undefined index: host in /home/myfolder/public_html/wp-includes/canonical.php on line 536
[20-Jul-2020 07:26:20 UTC] PHP Notice: Undefined index: host in /home/myfolder/public_html/wp-includes/canonical.php on line 537
[20-Jul-2020 07:26:20 UTC] PHP Notice: Undefined index: host in /home/myfolder/public_html/wp-includes/canonical.php on line 537
[20-Jul-2020 07:26:20 UTC] PHP Notice: Undefined index: host in /home/myfolder/public_html/wp-includes/canonical.php on line 538
[20-Jul-2020 07:26:20 UTC] PHP Notice: Undefined index: host in /home/myfolder/public_html/wp-includes/canonical.php on line 541
Je veux dire pourquoi ne vérifiez-vous pas wordpress pour http_host avant de l’utiliser ? Et plus précisément, quelle pourrait être la racine du problème? C’est peut-être un problème de sécurité ?
J’ai également lu que cet avertissement peut s’appliquer à un lien fait sans navigateur. Toute aide sera appréciée, merci d’avance.
(@autotutoriel)
il y a 4 mois, 1 semaine
Pour wp-includes/canonical.php 536 Modifier
if ( strtolower( $original['host'] ) == strtolower( $redirect['host'] ) ||
( strtolower( $original['host'] ) != 'www.' . strtolower( $redirect['host'] ) && 'www.' . strtolower( $original['host'] ) != strtolower( $redirect['host'] ) ) ) {
$redirect['host'] = $original['host'];
}
pour
if ( ! isset( $original['host'] ) ) {
// fixing notice host
$original['host'] = '';
}
if ( strtolower( $original['host'] ) == strtolower( $redirect['host'] ) ||
( strtolower( $original['host'] ) != 'www.' . strtolower( $redirect['host'] ) && 'www.' . strtolower( $original['host'] ) != strtolower( $redirect['host'] ) ) ) {
$redirect['host'] = $original['host'];
}
Pour ms-settings.php je travaille
Cette réponse a été modifiée il y a 4 mois, il y a une semaine par.
Cela a-t-il résolu votre problème ?
Was this helpful?
0 / 0