I've just switched my scripts to a different server. On the previous server this worked flawlessly, and now that I've switched them to a different server, I can't understand the problem.
I'm not sure it would help, but here's the relevant code.
$headers = apache_request_headers();
PHP Version is: PHP 5.3.2
You can use the following replacement function:
<?php if( !function_exists('apache_request_headers') ) { /// function apache_request_headers() { $arh = array(); $rx_http = '/\AHTTP_/'; foreach($_SERVER as $key => $val) { if( preg_match($rx_http, $key) ) { $arh_key = preg_replace($rx_http, '', $key); $rx_matches = array(); // do some nasty string manipulations to restore the original letter case // this should work in most cases $rx_matches = explode('_', $arh_key); if( count($rx_matches) > 0 and strlen($arh_key) > 2 ) { foreach($rx_matches as $ak_key => $ak_val) $rx_matches[$ak_key] = ucfirst($ak_val); $arh_key = implode('-', $rx_matches); } $arh[$arh_key] = $val; } } return( $arh ); } /// } /// ?>
Source: PHP Manual
From the docs, before the release of PHP 5.4.0:
This function is only supported when PHP is installed as an Apache module.
PHP 5.4.0 and later support this function unconditionally.
Said docs also include replacement functions that mimic the functionality of apache_request_headers
by stepping through $_SERVER
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With