Title: PHP Warning on Plugin Activation
Last modified: December 27, 2022

---

# PHP Warning on Plugin Activation

 *  Resolved [dragonsway76](https://wordpress.org/support/users/dragonsway76/)
 * (@dragonsway76)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/php-warning-on-plugin-activation/)
 * Hi there.. I use a script to deactivate and then re-activate my wp-fastest-cache
   plugin when I am pushing my site / db between Test / Staging / Production.
 * The issue is that I get a strange warning each time the your plugin is reactivated:
 * >     ```wp-block-code
   >     PHP Warning: Undefined array key "HTTP_HOST" in /home/adminuser/public_html/wp-content/plugins/wp-fastest-cache/inc/admin.php on line 703PHP Stack trace:PHP 1. {main}() /usr/local/bin/wp:0PHP 2. include() /usr/local/bin/wp:4PHP 3. include() phar:///usr/local/bin/wp/php/boot-phar.php:11PHP 4. WP_CLI\bootstrap() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php:32PHP 5. WP_CLI\Bootstrap\LaunchRunner->process($state = class WP_CLI\Bootstrap\BootstrapState { private $state = ['context_manager' => class WP_CLI\ContextManager { … }] }) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php:78PHP 6. WP_CLI\Runner->start() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:28PHP 7. WP_CLI\Runner->run_command_and_exit($help_exit_warning = uninitialized) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1256PHP 8. WP_CLI\Runner->run_command($args = [0 => 'plugin', 1 => 'activate', 2 => 'wp-fastest-cache'], $assoc_args = [], $options = uninitialized) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:442PHP 9. WP_CLI\Dispatcher\Subcommand->invoke($args = [0 => 'wp-fastest-cache'], $assoc_args = [], $extra_args = []) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:419PHP 10. call_user_func:{phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491}($callback = class Closure { virtual $closure = "$this->WP_CLI\Dispatcher{closure}", public $static = ['callable' => […]]; public $parameter = ['$args' => '', '$assoc_args' => ''] }, …$args = variadic([])) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491PHP 11. WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher{closure:phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:97-104}($args = [0 => 'wp-fastest-cache'], $assoc_args = []) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:491PHP 12. call_user_func:{phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100}($callback = [0 => class Plugin_Command { protected $item_type = 'plugin'; protected $obj_fields = […]; protected $upgrade_refresh = 'wp_update_plugins'; protected $upgrade_transient = 'update_plugins'; protected $chained_command = FALSE; private ${WP_CLI\CommandWithUpgrade}map = […]; protected $fetcher = class WP_CLI\Fetchers\Plugin { … } }, 1 => 'activate'], …$args = variadic([])) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100PHP 13. Plugin_Command->activate($args = [0 => 'wp-fastest-cache'], $assoc_args = []) phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:100PHP 14. activate_plugin($plugin = 'wp-fastest-cache/wpFastestCache.php', $redirect = '', $network_wide = NULL, $silent = uninitialized) phar:///usr/local/bin/wp/vendor/wp-cli/extension-command/src/Plugin_Command.php:347PHP 15. do_action($hook_name = 'activate_wp-fastest-cache/wpFastestCache.php', …$arg = variadic(NULL)) /home/adminuser/public_html/wp-admin/includes/plugin.php:691PHP 16. WP_Hook->do_action($args = [0 => NULL]) /home/adminuser/public_html/wp-includes/plugin.php:517PHP 17. WP_Hook->apply_filters($value = '', $args = [0 => NULL]) /home/adminuser/public_html/wp-includes/class-wp-hook.php:332PHP 18. wpfastestcache_activate(NULL) /home/adminuser/public_html/wp-includes/class-wp-hook.php:308PHP 19. WpFastestCacheAdmin->modifyHtaccess($post = ['wpFastestCacheStatus' => 'on', 'wpFastestCachePreload_homepage' => 'on', 'wpFastestCachePreload_page' => 'on', 'wpFastestCachePreload_customposttypes' => 'on', 'wpFastestCachePreload_customTaxonomies' => 'on', 'wpFastestCachePreload_number' => '4', 'wpFastestCachePreload_restart' => 'on', 'wpFastestCachePreload_order' => 'homepage,post,category,page,tag,attachment,customposttypes,customTaxonomies,number,restart,order', 'wpFastestCacheNewPost' => 'on', 'wpFastestCacheNewPost_type' => 'all', 'wpFastestCacheUpdatePost' => 'on', 'wpFastestCacheUpdatePost_type' => 'post', 'wpFastestCacheMinifyHtml' => 'on', 'wpFastestCacheMinifyCss' => 'on', 'wpFastestCacheCombineCss' => 'on', 'wpFastestCacheCombineJs' => 'on', 'wpFastestCacheGzip' => 'on', 'wpFastestCacheLBC' => 'on', 'wpFastestCacheLanguage' => 'eng']) /home/adminuser/public_html/wp-content/plugins/wp-fastest-cache/wpFastestCache.php:56PHP 20. WpFastestCacheAdmin->insertRewriteRule($htaccess = '# BEGIN GzipWpFastestCache\n\nAddType x-font/woff .woff\nAddType x-font/ttf .ttf\nAddOutputFilterByType DEFLATE image/svg+xml\nAddOutputFilterByType DEFLATE text/plain\nAddOutputFilterByType DEFLATE text/html\nAddOutputFilterByType DEFLATE text/xml\nAddOutputFilterByType DEFLATE text/css\nAddOutputFilterByType DEFLATE text/javascript\nAddOutputFilterByType DEFLATE application/xml\nAddOutputFilterByType DEFLATE application/xhtml+xml\nAddOutputFilterByType DEFLATE application/rss+xml\nAddOutputFilt'…, $post = ['wpFastestCacheStatus' => 'on', 'wpFastestCachePreload_homepage' => 'on', 'wpFastestCachePreload_page' => 'on', 'wpFastestCachePreload_customposttypes' => 'on', 'wpFastestCachePreload_customTaxonomies' => 'on', 'wpFastestCachePreload_number' => '4', 'wpFastestCachePreload_restart' => 'on', 'wpFastestCachePreload_order' => 'homepage,post,category,page,tag,attachment,customposttypes,customTaxonomies,number,restart,order', 'wpFastestCacheNewPost' => 'on', 'wpFastestCacheNewPost_type' => 'all', 'wpFastestCacheUpdatePost' => 'on', 'wpFastestCacheUpdatePost_type' => 'post', 'wpFastestCacheMinifyHtml' => 'on', 'wpFastestCacheMinifyCss' => 'on', 'wpFastestCacheCombineCss' => 'on', 'wpFastestCacheCombineJs' => 'on', 'wpFastestCacheGzip' => 'on', 'wpFastestCacheLBC' => 'on', 'wpFastestCacheLanguage' => 'eng']) /home/adminuser/public_html/wp-content/plugins/wp-fastest-cache/inc/admin.php:424PHP 21. WpFastestCacheAdmin->getHtaccess() /home/adminuser/public_html/wp-content/plugins/wp-fastest-cache/inc/admin.php:677PHP 22. WpFastestCacheAdmin->prefixRedirect() /home/adminuser/public_html/wp-content/plugins/wp-fastest-cache/inc/admin.php:765Plugin 'wp-fastest-cache' activated.
   >     ```
   > 
 * How do I get rid of this warning?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/php-warning-on-plugin-activation/#post-16322050)
 * HTTP_HOST must be defined. are you working on localhost?
 *  Thread Starter [dragonsway76](https://wordpress.org/support/users/dragonsway76/)
 * (@dragonsway76)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/php-warning-on-plugin-activation/#post-16322069)
 * ok.. how do I define HTTP_HOST? I have the same error on my local virtualbox 
   Test Server and on my remote Production server
 *  Thread Starter [dragonsway76](https://wordpress.org/support/users/dragonsway76/)
 * (@dragonsway76)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/php-warning-on-plugin-activation/#post-16322101)
 * I found a solution that seems to remove the warning:
 * > if ( defined( ‘WP_CLI’ ) && WP_CLI && ! isset( $_SERVER[‘HTTP_HOST’] ) ) {
   > 
   > $_SERVER[‘HTTP_HOST’] = ‘example.com’;}
 * added the above to my wp-config.php, with my local test url, warning gone… source
 * [https://make.wordpress.org/cli/handbook/guides/common-issues/](https://make.wordpress.org/cli/handbook/guides/common-issues/)
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/php-warning-on-plugin-activation/#post-16322609)
 * very nice 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘PHP Warning on Plugin Activation’ is closed to new replies.

 * ![](https://ps.w.org/wp-fastest-cache/assets/icon-256x256.png?rev=2064586)
 * [WP Fastest Cache - WordPress Cache Plugin](https://wordpress.org/plugins/wp-fastest-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-fastest-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-fastest-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-fastest-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-fastest-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-fastest-cache/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * Last activity: [3 years, 5 months ago](https://wordpress.org/support/topic/php-warning-on-plugin-activation/#post-16322609)
 * Status: resolved