Make PHP code that reads HTTP headers work on nginx or FastCGI without rewriting any of your existing calls.
Fix a 'call to undefined function getallheaders()' error when deploying a PHP app to a non-Apache server.
Add a portable HTTP header reader to a PHP library or framework so it works on any web server setup.
This is a small PHP library that solves a specific compatibility problem. PHP has a built-in function called getallheaders() that retrieves all the HTTP headers sent with an incoming web request. The problem is that this function only works when PHP is running as an Apache web server module. When PHP runs under other server setups, such as nginx or as a FastCGI process, the function is not available and calling it causes an error. This library provides a substitute version of getallheaders() that works in those other environments by reading the same header information from a different place (the $_SERVER variable, which PHP populates regardless of how it is running). If you install this library, your code can call getallheaders() the same way regardless of which web server is being used underneath. A drop-in replacement like this is commonly called a polyfill. You install it using Composer, which is the standard PHP package manager, with a single command. The library is intentionally minimal: it does one thing and has no dependencies beyond PHP itself. The README is short because the library is short.
← ralouphie on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.