Title: SERVER_NAME not in $_SERVER
Last modified: August 19, 2021

---

# SERVER_NAME not in $_SERVER

 *  [Netson](https://wordpress.org/support/users/netson/)
 * (@netson)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/server_name-not-in-_server/)
 * Hi, one of my customers is using this plugin for his woocommerce website, and
   I noticed th logs fill up with this message:
 * Undefined array key “SERVER_NAME” in /wp-content/plugins/woosa-in3/woosa-in3.
   php on line 44
 * This message only appears when running wp-cli and makes sense, because in a cli
   environment this variable is not set.
 * However, since wp-cli is used extensively for maintenance purposes, it would 
   be great if we can eliminate this warning message.
 * Perhaps something along these lines would fix the issue:
 * `$_SERVER['SERVER_NAME'] ?: php_uname("n")`
 * I hope you can fix this in the next update to avoid filling up my logfiles! 🙂
 * Regards,
    Rinck
 * Info: Ubuntu 18.04 LTS – PHP 8.0 – WordPress 5.8
    -  This topic was modified 4 years, 9 months ago by [Netson](https://wordpress.org/support/users/netson/).
    -  This topic was modified 4 years, 9 months ago by [Netson](https://wordpress.org/support/users/netson/).

Viewing 1 replies (of 1 total)

 *  Thread Starter [Netson](https://wordpress.org/support/users/netson/)
 * (@netson)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/server_name-not-in-_server/#post-14785756)
 * I actually just tested the code above and (for obvious reasons) it still outputs
   the warning; instead, this fixes the issue:
 * Replace on line 44:
    `$_SERVER["SERVER_NAME"]` with `(in_array('SERVER_NAME',
   $_SERVER) ? $_SERVER['SERVER_NAME'] : php_uname("n"))`

Viewing 1 replies (of 1 total)

The topic ‘SERVER_NAME not in $_SERVER’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/woosa-in3_3c39ad.svg)
 * [Woosa - in3 voor WooCommerce](https://wordpress.org/plugins/woosa-in3/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woosa-in3/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woosa-in3/)
 * [Active Topics](https://wordpress.org/support/plugin/woosa-in3/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woosa-in3/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woosa-in3/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [Netson](https://wordpress.org/support/users/netson/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/server_name-not-in-_server/#post-14785756)
 * Status: not resolved