apache_child_terminate — Terminate apache process after this request
Description
bool apache_child_terminate ( void )
apache_child_terminate() will register the Apache process executing the current PHP request for termination once execution of PHP code it is completed. It may be used to terminate a process after a script with high memory consumption has been run as memory will usually only be freed internally but not given back to the operating system.
Return Values
Returns TRUE if PHP is running as an Apache 1 module, the Apache version is non-multithreaded, and the child_terminate PHP directive is enabled (disabled by default). If these conditions are not met, FALSE is returned and an error of level E_WARNING is generated.
Notes
Note: This function is not implemented on Windows platforms.
See Also
[PHP]exit() [/PHP]
--------------------------------------------------------------------
(PHP 4 >= 4.3.2, PHP 5)
apache_get_modules — Get a list of loaded Apache modules
Description
array apache_get_modules ( void )
Get a list of loaded Apache modules.
Return Values
An array of loaded Apache modules.
Examples
[PHP]<?php
print_r(apache_get_modules());
?> [/PHP]
The above example will output something similar to:
[PHP]Array
(
[0] => core
[1] => http_core
[2] => mod_so
[3] => sapi_apache2
[4] => mod_mime
[5] => mod_rewrite
)[/PHP]
--------------------------------------------------------------------
(PHP 4 >= 4.3.2, PHP 5)
apache_get_version — Fetch Apache version
Description
string apache_get_version ( void )
Fetch the Apache version.
Return Values
Returns the Apache version on success, or FALSE on failure.
Examples
[PHP]<?php
$version = apache_get_version();
echo "$version\n";
?> [/PHP]
The above example will output something similar to:
Apache/1.3.29 (Unix) PHP/4.3.4
See Also
[PHP]phpinfo(); [/PHP]
--------------------------------------------------------------------
apache_getenv — Get an Apache subprocess_env variable
Description
string apache_getenv ( string $variable [, bool $walk_to_top] )
Get an Apache environment variable as specified by variable.
This function requires Apache 2 otherwise it's undefined.
Parameters
variable
The Apache environment variable
walk_to_top
Whether to get the top-level variable available to all Apache layers.
Return Values
The value of the Apache environment variable on success, or FALSE on failure
Examples
The example above shows how to retrieve the value of the Apache environment variable SERVER_ADDR.
[PHP]<?php
$ret = apache_getenv("SERVER_ADDR");
echo $ret;
?>[/PHP]
The above example will output something similar to:
42.24.42.240
See Also
[PHP]apache_setenv()
getenv()
Superglobals[/PHP]
--------------------------------------------------------------------
apache_lookup_uri — Perform a partial request for the specified URI and return all info about it
Description
object apache_lookup_uri ( string $filename )
This performs a partial request for a URI. It goes just far enough to obtain all the important information about the given resource.
This function is only supported when PHP is installed as an Apache module.
Parameters
filename
The filename (URI) that's being requested.
Return Values
An object of related URI information. The properties of this object are:
status
the_request
status_line
method
content_type
handler
uri
filename
path_info
args
boundary
no_cache
no_local_copy
allowed
send_bodyct
bytes_sent
byterange
clength
unparsed_uri
mtime
request_time
Examples
[PHP]<?php
$info = apache_lookup_uri('index.php?var=value');
print_r($info);
if (file_exists($info->filename)) {
echo 'file exists!';
}
?> [/PHP]
The above example will output something similar to:
Code: Select all
stdClass Object
(
[status] => 200
[the_request] => GET /dir/file.php HTTP/1.1
[method] => GET
[mtime] => 0
[clength] => 0
[chunked] => 0
[content_type] => application/x-httpd-php
[no_cache] => 0
[no_local_copy] => 1
[unparsed_uri] => /dir/index.php?var=value
[uri] => /dir/index.php
[filename] => /home/htdocs/dir/index.php
[args] => var=value
[allowed] => 0
[sent_bodyct] => 0
[bytes_sent] => 0
[request_time] => 1074282764
)
file exists!
apache_note — Get and set apache request notes
Description
string apache_note ( string $note_name [, string $note_value] )
apache_note() is an Apache-specific function which gets and sets values in a request's notes table.
Parameters
note_name
The name of the note.
note_value
The value of the note.
Return Values
If called with one argument, it returns the current value of note note_name. If called with two arguments, it sets the value of note note_name to note_value and returns the previous value of note note_name. If the note cannot be retrieved, FALSE is returned
--------------------------------------------------------------------
(PHP 4 >= 4.3.0, PHP 5)
apache_request_headers — Fetch all HTTP request headers
Description
array apache_request_headers ( void )
Fetches all HTTP requests from the current request.
This function is only supported when PHP is installed as an Apache module.
Return Values
An associative array of all the HTTP headers in the current request, or FALSE on failure.
Examples
[PHP]<?php
$headers = apache_request_headers();
foreach ($headers as $header => $value) {
echo "$header: $value
\n";
}
?> [/PHP]
The above example will output something similar to:
Code: Select all
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0
Host: www.example.com
Connection: Keep-Alive
Notes
Note: Prior to PHP 4.3.0, apache_request_headers() was called getallheaders(). After PHP 4.3.0, getallheaders() is an alias for apache_request_headers().
Note: You can also get at the value of the common CGI variables by reading them from the environment, which works whether or not you are using PHP as an Apache module. Use phpinfo() to see a list of all of the available environment variables.
Note: As of PHP 4.3.3 you can use this function with the NSAPI server module in Netscape/iPlanet/SunONE webservers, too.
See Also
[PHP]apache_response_headers() [/PHP]
--------------------------------------------------------------------
(PHP 5 >= 5.1.0)
apache_reset_timeout — Reset the Apache write timer
Description
bool apache_reset_timeout ( void )
apache_reset_timeout() resets the Apache write timer, which defaults to 300 seconds. With set_time_limit(0); ignore_user_abort(true) and periodic apache_reset_timeout() calls, Apache can theoretically run forever.
This function requires Apache 1.
Return Values
Returns TRUE on success or FALSE on failure.
Notes
Note: This function is disabled in safe mode.
--------------------------------------------------------------------
(PHP 4 >= 4.3.0, PHP 5)
apache_response_headers — Fetch all HTTP response headers
Description
array apache_response_headers ( void )
Fetch all HTTP response headers.
Return Values
An array of all Apache response headers on success, or FALSE on failure.
Examples
[PHP]<?php
print_r(apache_response_headers());
?> [/PHP]
The above example will output something similar to:
Code: Select all
Array
(
[Accept-Ranges] => bytes
[X-Powered-By] => PHP/4.3.8
)
Notes
Note: As of PHP 4.3.3 you can use this function with the NSAPI server module in Netscape/iPlanet/SunONE webservers, too.
See Also
[PHP]apache_request_headers()
headers_sent()
[/PHP]
--------------------------------------------------------------------
(PHP 4 >= 4.2.0, PHP 5)
apache_setenv — Set an Apache subprocess_env variable
Description
bool apache_setenv ( string $variable, string $value [, bool $walk_to_top] )
apache_setenv() sets the value of the Apache environment variable specified by variable.
Note: When setting an Apache environment variable, the corresponding $_SERVER variable is not changed.
Parameters
variable
The environment variable that's being set.
value
The new variable value.
walk_to_top
Whether to set the top-level variable available to all Apache layers.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
[PHP]<?php
apache_setenv("EXAMPLE_VAR", "Example Value");
?>[/PHP]
Notes
Note: apache_setenv() can be paired up with apache_getenv() across separate pages or for setting variables to pass to Server Side Includes (.shtml) that have been included in PHP scripts.
See Also
[PHP]apache_getenv()[/PHP]
--------------------------------------------------------------------
(No version information available, might be only in CVS)
ascii2ebcdic — Translate string from ASCII to EBCDIC
Description
int ascii2ebcdic ( string $ascii_str )
ascii2ebcdic() is an Apache-specific function which is available only on EBCDIC based operating systems (OS/390, BS2000). It translates the ASCII encoded string ascii_str to its equivalent EBCDIC representation (binary safe), and returns the result.
Parameters
ascii_str
The ASCII string that will be translated.
Return Values
The EBCDIC representation of an ASCII string.
See Also
[PHP]ebcdic2ascii() [/PHP]
--------------------------------------------------------------------
(No version information available, might be only in CVS)
ebcdic2ascii — Translate string from EBCDIC to ASCII
Description
int ebcdic2ascii ( string $ebcdic_str )
ebcdic2ascii() is an Apache-specific function which is available only on EBCDIC based operating systems (OS/390, BS2000). It translates the EBCDIC encoded string ebcdic_str to its equivalent ASCII representation (binary safe), and returns the result.
Parameters
ebcdic_str
The EBCDIC string that will be translated.
Return Values
The ASCII representation of an EBCDIC string.
See Also
Code: Select all
ascii2ebcdic()
--------------------------------------------------------------------
(PHP 4, PHP 5)
getallheaders — Fetch all HTTP request headers
Description
array getallheaders ( void )
Fetches all HTTP requests from the current request.
This function is an alias for apache_request_headers(). Please read the apache_request_headers() **** for more information on how this function works.
This function is only supported when PHP is installed as an Apache module.
Return Values
An associative array of all the HTTP headers in the current request, or FALSE on failure.
Notes
Note: As of PHP 4.3.3 you can use this function with the NSAPI server module in Netscape/iPlanet/SunONE webservers, too.
See Also
Code: Select all
apache_response_headers()
--------------------------------------------------------------------
(PHP 4, PHP 5)
virtual — Perform an Apache sub-request
Description
bool virtual ( string $filename )
virtual() is an Apache-specific function which is similar to <!--#include virtual...--> in mod_include. It performs an Apache sub-request. It is useful for including CGI scripts or .shtml files, or anything else that you would parse through Apache. Note that for a CGI script, the script must generate valid CGI headers. At the minimum that means it must generate a Content-type header.
To run the sub-request, all buffers are terminated and flushed to the browser, pending headers are sent too.
This function is only supported when PHP is installed as an Apache module.
Parameters
filename
The file that the virtual command will be performed on.
Return Values
Performs the virtual command on success, or returns FALSE on failure.
Notes
Warning
The query string can be passed to the included file but $_GET is copied from the parent script and only $_SERVER['QUERY_STRING'] is filled with the passed query string. The query string may only be passed when using Apache 2. The requested file will not be listed in the Apache access log.
Note: Environment variables set in the requested file are not visible to the calling script.
Note: As of PHP 4.3.3 you can use this function with the NSAPI server module in Netscape/iPlanet/SunONE webservers, too.