# Undefined array key "HTTP\_HOST" error in CLI when export SIte

**URL:** <https://community.localwp.com/t/undefined-array-key-http-host-error-in-cli-when-export-site/47215>\
**Category:** Support\
**Created:** [February 25, 2025, 3:22pm UTC](https://community.localwp.com/t/undefined-array-key-http-host-error-in-cli-when-export-site/47215 "2025-02-25T15:22:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PascalDUBOIN](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/pascalduboin/32/22022_2.png) [@PascalDUBOIN](https://community.localwp.com/u/PascalDUBOIN)\
**Post date:** [February 25, 2025, 3:22pm UTC](https://community.localwp.com/t/undefined-array-key-http-host-error-in-cli-when-export-site/47215/1 "2025-02-25T15:22:02Z")

</div>

[25-Feb-2025 15:20:41 UTC] PHP Warning: Undefined array key “HTTP\_HOST” in phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP\_CLI/Runner.php(1335) : eval()'d code on line 56

---

<div class="post-metadata">

**Author:** ![nickc](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/nickc/32/21209_2.png) [@nickc](https://community.localwp.com/u/nickc)\
**Post date:** [February 26, 2025, 8:30am UTC](https://community.localwp.com/t/undefined-array-key-http-host-error-in-cli-when-export-site/47215/2 "2025-02-26T08:30:33Z")

</div>

Do you have `$_SERVER['HTTP_HOST']` somewhere in your `wp-config.php` (or perhaps elsewhere in your plugin/theme codebase)?

If so, you will need to give it a default value for use outside of server contexts (e.g. when you run WP-CLI) as it recommends in its docs:

> When using `$_SERVER['HTTP_HOST']` in your `wp-config.php`, you’ll need to set a default value in WP-CLI context:

```php
if ( defined( 'WP_CLI' ) && WP_CLI && ! isset( $_SERVER['HTTP_HOST'] ) ) {
    $_SERVER['HTTP_HOST'] = 'example.com';
}

```

> **[Common Issues](https://make.wordpress.org/cli/handbook/guides/common-issues/#php-notice-undefined-index-on-_server-superglobal)**
>
> Error: Can’t connect to the database A few possibilities: a) you’re using MAMP, but WP-CLI is not using the MAMP PHP binary. You can check which PHP WP-CLI is using by running wp –…
