Title: WP-CLI error: Undefined array key &#8220;HTTP_HOST&#8221;
Last modified: March 9, 2023

---

# WP-CLI error: Undefined array key “HTTP_HOST”

 *  Resolved [gmariani405](https://wordpress.org/support/users/gmariani405/)
 * (@gmariani405)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/wp-cli-error-undefined-array-key-http_host/)
 *     ```wp-block-code
       PHP Warning:  Undefined array key "HTTP_HOST" in /chroot/home/.../wp-content/plugins/wp-datepicker/index.php on line 28
       ```
   
 * I fixed this by doing this:
 *     ```wp-block-code
       $HTTP_HOST = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (string)parse_url(get_option('siteurl'), PHP_URL_HOST);
       $wpdp_actual_link = $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$HTTP_HOST$_SERVER[REQUEST_URI]";
       ```
   
 * Maybe this could be added in the next release? Thanks!

Viewing 1 replies (of 1 total)

 *  Plugin Author [Fahad Mahmood](https://wordpress.org/support/users/fahadmahmood/)
 * (@fahadmahmood)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/wp-cli-error-undefined-array-key-http_host/#post-16542321)
 * Thank you for this contribution, it has been added in the next release. Please
   check and confirm.

Viewing 1 replies (of 1 total)

The topic ‘WP-CLI error: Undefined array key “HTTP_HOST”’ is closed to new replies.

 * ![](https://ps.w.org/wp-datepicker/assets/icon-256x256.gif?rev=2286804)
 * [WP Datepicker](https://wordpress.org/plugins/wp-datepicker/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-datepicker/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-datepicker/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-datepicker/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-datepicker/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-datepicker/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Fahad Mahmood](https://wordpress.org/support/users/fahadmahmood/)
 * Last activity: [3 years, 2 months ago](https://wordpress.org/support/topic/wp-cli-error-undefined-array-key-http_host/#post-16542321)
 * Status: resolved