dulldusk / phpfm

phpFileManager is a complete filesystem management tool on a single file. This is a tool meant for rapid file access, and also to verify the server php configuration and security. The script can be renamed and deployed on an unique known url, and offers password protection.
https://sourceforge.net/projects/phpfm/
Other
216 stars 98 forks source link

Call to undefined function apache_request_headers() : solved #45

Closed bdienot closed 3 years ago

bdienot commented 3 years ago

Hi, on nginx server the Call to undefined function apache_request_headers() can be solved by adding this function just after Header and Globals.

see : https://stackoverflow.com/questions/2916232/call-to-undefined-function-apache-request-headers

// +-------------------------------------------------- // | Header and Globals // +--------------------------------------------------

//function to solve error Call to undefined function apache_request_headers() on non apache servers if( !function_exists('apache_request_headers') ) { /// function apache_request_headers() { $arh = array(); $rxhttp = '/\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 $rxmatches = 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 ); } /// } ///