How do I get the request limitation size in IIS via PHP?
From: Phil Powell (soazine_at_erols.com)
Date: 06/21/04
- Next message: Steven Burn: "Re: Where to download IIS ?"
- Previous message: Not very web smart guy: "assign name"
- Messages sorted by: [ date ] [ thread ]
Date: 21 Jun 2004 15:43:01 -0700
Following is my function I wrote to retrieve the value of
LimitRequestBody in php.conf if the webserver is Apache:
[PHP]
/*-----------------------------------------------------------------------------------------------------------------------------
There is no native method in PHP to obtain a value that is in a
separate CONFIG file, particularly
/etc/httpd/conf.d/php.conf, therefore, you will have to obtain it
yourself the hard way: splice up the
file and retrieve and set into a session variable, or, obtain from
the existing session variable
-------------------------------------------------------------------------------------------------------------------------------*/
function &getLimitRequestBody() {
global $limitRequestBodyFilePath;
if ($_SESSION['limitRequestBody']) {
return $_SESSION['limitRequestBody'];
} else {
$fileID = @fopen($limitRequestBodyFilePath, 'r');
if (!$fileID) return 0; // BOMB OUT - $limitRequestBodyFilePath SET
IN CSV FILE AND IS REQUIRED TO OBTAIN LimitRequestBody
$contents = @fread($fileID, filesize($limitRequestBodyFilePath));
@fclose($fileID);
preg_match('/LimitRequestBody[\s\t]*([0-9]+)\n*/i', $contents,
$matchArray);
$_SESSION['limitRequestBody'] = (int)trim($matchArray[1]);
return (int)trim($matchArray[1]);
}
}
[/PHP]
Nice function, however, HUGE dilemma: the application that will use
this function is designed to be fully portable, that is, it can run in
Apache or IIS or anything that can run PHP. That means everything in
this application needs to run equally in any webserver that can handle
PHP, including this function.
This function works only if you're using Apache since it retrieves a
specific file /etc/httpd/conf.d/php.conf that has a value I need that
PHP itself cannot provide to determine the absolute limit of a
request.
So how do I write this for IIS or any other PHP-friendly webserver?
Thanx
Phil
- Next message: Steven Burn: "Re: Where to download IIS ?"
- Previous message: Not very web smart guy: "assign name"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|