Title: Undefined function getallheaders()
Last modified: September 11, 2019

---

# Undefined function getallheaders()

 *  Resolved [MattBoutet](https://wordpress.org/support/users/mattboutet/)
 * (@mattboutet)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/undefined-function-getallheaders/)
 * If you’re running this plugin under Nginx / PHP-FPM you’ll receive an error:
 * `PHP Fatal error: Uncaught Error: Call to undefined function getallheaders() 
   in /app/public/wp-content/plugins/wp-rest-api-authentication/admin/partials/flow/
   class-mo-api-authentication-tokenapi.php:6`
 * It’s possible to “fix” this (scare quotes because I’ve not yet thoroughly tested
   this) with this snippet from [https://wordpress.org/support/topic/call-to-undefined-function-getallheaders/](https://wordpress.org/support/topic/call-to-undefined-function-getallheaders/):
 *     ```
               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;
                   }
               }
       ```
   
 * Edit: I’d submit a PR, but it doesn’t appear that this plugin is on wordpress,
   and I’m not set up with SVN.
    -  This topic was modified 6 years, 9 months ago by [MattBoutet](https://wordpress.org/support/users/mattboutet/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [miniOrange](https://wordpress.org/support/users/cyberlord92/)
 * (@cyberlord92)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/undefined-function-getallheaders/#post-11938190)
 * Hi,
 * Thanks for pointing this out.
 * We will verify this with Nginx / PHP-FPM and will have this published very soon.
 * Let me know if there is anything else we can add in the plugin.
 * Thanks.

Viewing 1 replies (of 1 total)

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

 * ![](https://ps.w.org/wp-rest-api-authentication/assets/icon-128x128.png?rev=2084327)
 * [JWT Authentication for WP REST APIs](https://wordpress.org/plugins/wp-rest-api-authentication/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-rest-api-authentication/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-rest-api-authentication/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-rest-api-authentication/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-rest-api-authentication/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-rest-api-authentication/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [miniOrange](https://wordpress.org/support/users/cyberlord92/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/undefined-function-getallheaders/#post-11938190)
 * Status: resolved