Fix call to getallheaders()

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