Title: Call to undefined function getallheaders()
Last modified: August 28, 2018

---

# Call to undefined function getallheaders()

 *  Resolved [Nazar Hotsa](https://wordpress.org/support/users/bugnumber9/)
 * (@bugnumber9)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/call-to-undefined-function-getallheaders/)
 * Hi Gioni,
 * I’ve enabled “Save request headers”, “Save $ SERVER” and “Save request cookies”
   options in Traffic Inspector and the following error pops up in error log:
 *     ```
       PHP Fatal error:  Uncaught Error: Call to undefined function getallheaders() in .../wp-content/plugins/wp-cerber/cerber-load.php:4933
       Stack trace:
       #0 [internal function]: cerber_traffic_log()
       #1 {main}
         thrown in .../wp-content/plugins/wp-cerber/cerber-load.php on line 4933
       ```
   
 * Judging from [https://www.popmartian.com/tipsntricks/2015/07/14/howto-use-php-getallheaders-under-fastcgi-php-fpm-nginx-etc/](https://www.popmartian.com/tipsntricks/2015/07/14/howto-use-php-getallheaders-under-fastcgi-php-fpm-nginx-etc/)
   the problem is here:
 * > If you use Nginx, PHP-FPM or any other FastCGI method of running PHP you’ve
   > probably noticed that the function getallheaders() does not exist.
 * Indeed, the website that has this issue runs under PHP-FPM. A simple fix from
   the above article:
 *     ```
       if (!function_exists('getallheaders')) {
           function getallheaders() {
           $headers = [];
           foreach ($_SERVER as $name => $value) {
               if (substr($name, 0, 5) == 'HTTP_') {
                   $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
               }
           }
           return $headers;
           }
       }
       ```
   
 * Hope this helps 🙂

Viewing 1 replies (of 1 total)

 *  Plugin Author [gioni](https://wordpress.org/support/users/gioni/)
 * (@gioni)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/call-to-undefined-function-getallheaders/#post-10647004)
 * Hi Nazar! Thanks for telling me! I think I’ll implement this fix in the next 
   version.

Viewing 1 replies (of 1 total)

The topic ‘Call to undefined function getallheaders()’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-cerber_77a9bf.svg)
 * [WP Cerber Security, Anti-spam & Malware Scan](https://wordpress.org/plugins/wp-cerber/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-cerber/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-cerber/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-cerber/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-cerber/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-cerber/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [gioni](https://wordpress.org/support/users/gioni/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/call-to-undefined-function-getallheaders/#post-10647004)
 * Status: resolved