# Php apache\_request\_headers() replicement?

**URL:** <https://www.ruby-forum.com/t/php-apache-request-headers-replicement/192975>\
**Category:** NGINX\
**Created:** [August 9, 2010, 12:27pm UTC](https://www.ruby-forum.com/t/php-apache-request-headers-replicement/192975 "2010-08-09T12:27:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![HSSS\_seyin\_Mert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/6a8cbe/32.png) [@HSSS\_seyin\_Mert](https://www.ruby-forum.com/u/HSSS_seyin_Mert)\
**Post date:** [August 9, 2010, 12:27pm UTC](https://www.ruby-forum.com/t/php-apache-request-headers-replicement/192975/1 "2010-08-09T12:27:35Z")

</div>

Hello,  
I’m developing a xhr uploading script by using

> **[GitHub - valums/file-uploader](https://github.com/valums/file-uploader)**
>
> Contribute to valums/file-uploader development by creating an account on GitHub.

But nginx has no apache\_request\_headers function, and find from [php.net](http://php.net)  
an  
replicement.

function _apache\_request\_headers() {  
foreach($SERVER as $key=\>$value) {  
if (substr($key,0,5)=="HTTP") {  
$key=str\_replace(" “,”-“,ucwords(strtolower(str\_replace(”_“,”  
",substr($key,5)))));  
$out[$key]=$value;  
}  
}  
return $out;  
}

my problem is that upload script has following function that needs a  
content-lenght param which nginx does not have

function getSize(){  
$headers = _apache\_request\_headers_();  
return (int)_$headers[‘Content-Length’]_;  
}

so I add an extra param to my site config

fastcgi\_param CONTENT-LENGTH $content\_length;

this parameter is needed for how much bytes uploaded to the server  
(maybe I  
get it wrong) , how can I fix this issue? Thanks for all…
