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

search for in the

apache_child_terminate> <dotnet_load
Last updated: Tue, 27 Nov 2007

view this page in

Funciones específicas de Apache

Introducción

Estas funciones están disponibles solamente cuando PHP se ejecuta como módulo de Apache 1.x.

Instalación

Información sobre la instalación de PHP con Apache se puede encontrar en el capítulo sobre instalación en la sección sobre Apache

Configuración en tiempo de ejecución

El comportamiento del módulo PHP de Apache está sujeto a los parámetros ajustados en php.ini. Los parámetros ajustados mediante php_flag en el archivo de configuración del servidor o archivos .htaccess locales, tendrán preferencia sobre aquellos ajustados en php.ini.

Example#1 Desactivar el intérprete PHP en un directorio utilizando .htaccess

php_flag engine off

Opciones de configuración de Apache
Nombre Por defecto Modificable Función
engine On PHP_INI_ALL habilita o desactiva el intérprete PHP
child_terminate Off PHP_INI_ALL especifica si los scripts PHP pueden requerir la terminación del proceso hijo al acabar un requerimiento. Véase también apache_child_terminate()
last_modified Off PHP_INI_ALL enviar la fecha de modificación de los scripts PHP como la fecha de la última modifición en la cabecera del requerimiento actual
xbithack Off PHP_INI_ALL interpretar los archivos cuyo bit ejecutable esté fijado a PHP, independientemente de su extensión

A continuación se presenta una corta explicación de las directivas de configuración.

engine boolean

Esta directiva realmente sólo es útil cuando PHP es un módulo de Apache. Se utiliza para sitios que quieran activar o desactivar el intérprete de PHP en función del directorio o del host-virtual. Añadiendo engine off en los lugares apropiados del archivo httpd.conf, PHP puede ser habilitado o desactivado.

Tipos de recursos

Esta extensión no tiene ningún tipo de recurso definido.

Constantes predefinidas

Esta extensión no tiene ninguna constante definida.

Table of Contents



apache_child_terminate> <dotnet_load
Last updated: Tue, 27 Nov 2007
 
add a note add a note User Contributed Notes
Apache
bgshea at gmail dot com
29-Nov-2005 05: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
02-Nov-2005 01: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 05: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 02: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
11-Jan-2002 01: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
jarl at diku dot dk
25-Mar-2000 01:12
Many of the environment variables can be found here:
http://www.php.net/manual/language.variables.predefined.php

apache_child_terminate> <dotnet_load
Last updated: Tue, 27 Nov 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites