downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

apache_child_terminate> <dotnet_load
[edit] Last updated: Mon, 01 Nov 2010

view this page in

II. Apache-spezifische Funktionen

Einführung

Diese Funktionen stehen nur zur Verfügung, wenn PHP als Apache Modul läuft.

Anmerkung: Die Servervariable PATH_TRANSLATED wird bei Verwendung des Apache 2 SAPI nicht mehr länger implizit gesetzt. Im Gegensatz hierzu wird bei Verwendung des Apache 1 SAPI PATH_TRANSLATED, falls von Apache nicht zur Verfügung gestellt, auf den gleichen Wert wie die Servervariable SCRIPT_FILENAME gesetzt. Die Veränderung unter Apache 2 wurde vorgenommen um der » CGI Spezification zu entsprechen. Für weitere Informationen shauen Sie bitte unter » bug #23610 nach.

Installation

Informationen zur Installation von PHP unter Apache finden Sie im Kapitel Installation.

Laufzeit Konfiguration

Das Verhalten des Apache PHP-Moduls wird durch Einstellungen in der php.ini beeinflusst. Konfigurationseinstellungen aus der php.ini können Sie durch php_flag Einstellungen in der Server Konfigurationsdatei oder lokal in .htaccess Dateien überschreiben.

Beispiel 151. Parsen von PHP für ein Verzeichnis ausschalten mittels .htaccess

php_flag engine off

Tabelle 15. Apache Konfigurations Optionen

BezeichnungGrundeinstellungÄnderbar
engineOnPHP_INI_ALL
child_terminateOffPHP_INI_ALL
last_modifiedOffPHP_INI_ALL
xbithackOffPHP_INI_ALL

Weitere Details und die Definition der PHP_INI_* Konstanten sind unter ini_set() zu finden.

Hier eine kurze Erklärung der Konfigurationsoptionen:

engine boolean

Parsen von PHP ein/-auschalten. Diese Option ist in erster Linie nur sinnvoll, wenn PHP als Modul unter Apache läuft. Sie wird von Seiten benutzt, die den PHP-Parser für bestimmte Verzeichnisse oder virtuelle Server aus- bzw. einschalten wollen. Wenn Sie engine off in den dafür vorgesehenen Blöcken in der httpd.conf Datei benutzen, kann PHP gezielt aktiviert bzw. deaktiviert werden.

child_terminate boolean

Gibt an, ob PHP Skripte veranlassen, dass Kindprozesse nach dem Request beendet werden, siehe auch apache_child_terminate().

last_modified boolean

Das letzte Datum der Änderung des PHP Skripts wird als Last-Modified: header für diesen Request gesendet.

xbithack boolean

Dateien mit gesetztem ausführbaren Bit werden unabhängig von ihrer Dateiendung durch PHP geparst.

Resource Typen

Diese Erweiterung definiert keine Resource-Typen.

Vordefinierte Konstanten

Diese Erweiterung definiert keine Konstanten.

Inhaltsverzeichnis

apache_child_terminate — Beendet einen Apache Prozess nach der Anfrage
apache_get_modules — Liste der geladenen Apachemodule
apache_get_version — Liefert die Version von Apache
apache_getenv — Get an Apache subprocess_env variable
apache_lookup_uri — Führt eine Teilanfrage für eine URI durch und liefert alle Informationen darüber zurück.
apache_note — Setzt und liest Apache Notes
apache_request_headers — Liefert alle HTTP-Header der aktuellen Anfrage
apache_reset_timeout — Reset the Apache write timer
apache_response_headers — Liefert alle HTTP-Antwort Header
apache_setenv — Setzt eine Apache subprocess_env Variable
ascii2ebcdic — Zeichenkette von ASCII in EBCDIC übersetzen
ebcdic2ascii — Zeichenkette von EBCDIC in ASCII übersetzen
getallheaders — Liefert alle HTTP-Header der aktuellen Anfrage aus
virtual — Führt eine Apache-Unteranfrage durch


apache_child_terminate> <dotnet_load
[edit] Last updated: Mon, 01 Nov 2010
 
add a note add a note User Contributed Notes Apache-spezifische Funktionen
bgshea at gmail dot com 28-Nov-2005 07:41
here is a dynamic version of henk_nicolai at REMOVE-THIS at hotmail dot com's code

    $req = $_SERVER['REQUEST_URI'];
    // Remove rubbish.
    $newReq = ereg_replace ( $_SERVER['SCRIPT_NAME'] . '[^?]*', $_SERVER['SCRIPT_NAME'], $req);
    if (strlen($newReq) < strlen($req))
    {
        header ('Location: '.$newReq);
        header ('HTTP/1.0 301 Moved Permanently');
        die;  // Don't send any more output.
    }
    unset($req);
    unset($newReq);

this can be placed at the top of any file that is to be access by the URI.
pike 01-Nov-2005 03:16
to henk_nicolai

the behaviour you describe is not a "glitch" of apache :-). an url like
"http://my_server.nl/index.php/foo".  should return the resource http://my_server.nl/index.php and pass "/foo" as PATH_INFO in the environment.

which is extremely usefull if you use it wisely.

for more info on PATH_INFO and PATH_TRANSLATED, see http://nl2.php.net/reserved.variables . PATH_INFO is not related to the php pathinfo() function

$2c,
*pike
outofnet at mail dot ru 27-Aug-2004 07:44
Important info for Apache2 users that have several virtual hosts.

It seems php_flag directive has a different behaviour under Apache 2 (from what it is under 1.3) when used inside <VirtualHost> block.

If you override global php.ini settings with php_flag for one of your virtual host - then your other non-customized virtual hosts may use this overrided settings as well. php_flag records are messed up among different virtual hosts under single Apache 2 server. It may result from Apache 2 multi-thread nature.

Here is an example:

Suppose you have two Virtual hosts: V1 and V2.
For V1 in Apache configuration you use
php_flag magic_quotes_gpc 1
V2 is supposed to use global php.ini settings, so you didn't put any php_flag records into Apache conf for V2 (this worked under Apache 1.3).
And your default php.ini settings are:
php_flag magic_quotes_gpc 0

When you run your server you'll notice that magic quotes is (sometimes) set to On at V2!
The value turns On at V2 when there have been a previous request to V1.

To solve the problem either move php_flag into .htaccess located inside customized virtual host directory OR put php_flag with default settings into all your <VirtualHost> blocks that are not customized. So for V2 put:
php_flag magic_quotes_gpc 0

It is critical to be very carefull with php_flag engine 0.

My configuration is:
PHP 4.3.4, Apache 2.0.50, Linux RedHat 9
henk_nicolai at REMOVE-THIS at hotmail dot com 20-Nov-2002 04:03
My Apache server has a problem when someone enters a URI like: "http://my_server.nl/index.php/". (Note the extra slash.) The server executes the index.php script anyway, which causes the browser directory and the current directory used in the script to be different. And therefore my relative links don't work, and my stylesheet is not loaded. A quick test ("http://www.php.net/manual/en/index.php/") reveals that also this site has this glitch.

When a client requests a directory without the last slash ("http://www.php.net/manual") the server sends a HTTP 301 (Moved Permanently) response with a redirect to the correct URI ("http://www.php.net/manual/"), and my idea was to do the same when the user adds a slash too much:

<?php
   $req
= $_SERVER['REQUEST_URI'];
  
// Remove rubbish.
  
$newReq = ereg_replace ('index.php[^?]*', 'index.php', $req);
   if (
strlen($newReq) < strlen($req)) {
    
header ('Location: '.$newReq);
    
header ('HTTP/1.0 301 Moved Permanently');
     die; 
// Don't send any more output.
  
}
   unset(
$req); unset($newReq);

   ... (
rest of the script) ...
?>

Replace every occurence of 'index.php' with your filename and you're done. Hope it helps. :-)

(Note: I'm not using fragments in my URI's (like 'index.php#bottom'), and this code may not do what you want if you are using them.)
cjm2 at earthling dot net 10-Jan-2002 03:40
If you are trying to find a Handler to use with apache's mod_mime functions (e.g. SetHandler).  Use the MIME type associated with php.

e.g. SetHandler application/x-httpd-php

 
show source | credits | sitemap | contact | advertising | mirror sites