Fix call to getallheaders()

The function getallheaders() exists only if PHP is loaded as an Apache module.

This fix provides an alternative if it is not defined.