PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<Guida Funzioniapache_child_terminate>
view the version of this page
Last updated: Sun, 02 May 2004

I. Funzioni Apache

Introduzione

Queste funzioni sono disponibili unicamente quando PHP è eseguito come modulo Apache.

Installazione

Per l'installazione di PHP su Apache vedere la sezione Apache nel capitolo che tratta l'installazione.

Configurazione di Runtime

Il comportamento del modulo Apache per PHP è influenzato dalle impostazioni in php.ini. Le impostazioni di configurazione del php.ini possono essere scavalcate attraverso le impostazioni php_flag nel file di configurazione del server o nei file .htaccess locali.

Esempio 1. disabilitazione dell'interprete PHP in una directory mediante .htaccess

php_flag engine off

Tabella 1. Opzioni di configurazione di Apache

NomeDefaultModificabileFunzione
engineOnPHP_INI_ALLaccende o spegne l'interprete PHP
child_terminateOffPHP_INI_ALL decide se gli script PHP possono richiedere la terminazione dei processi figli alla fine della richiesta HTTP, vedere anche apache_child_terminate()
last_modifiedOffPHP_INI_ALLmanda la data di modifica degli script nell'header Last-Modified:
xbithackOffPHP_INI_ALLinterpreta i file con il bit di esecuzione impostato, a prescindere dalla loro estensione

Breve descrizione dei parametri di configurazione.

engine boolean

Questa direttiva è utile solo nella versione di PHP compilata come modulo di Apache. Viene usata dai siti che vogliono spegnere e accendere il parsing PHP in base alla directory o al virtual server corrente. Inserendo engine off nel posto appropriato nel file httpd.conf, il PHP può essere abilitato o disabilitato.

Tipi di risorse

Questa estensione non definisce alcun tipo di risorsa.

Costanti predefinite

Questa estensione non definisce alcuna costante.

Sommario
apache_child_terminate -- Interrompe il processo apache dopo la presente richiesta
apache_get_modules --  Get a list of loaded Apache modules
apache_get_version --  Fetch Apache version
apache_getenv --  Get an Apache subprocess_env variable
apache_lookup_uri --  Esegue una richiesta parziale della URI specificata e restituisce tutte le informazioni
apache_note -- Ricava o imposta una variabile nella tabella notes di Apache
apache_request_headers -- Estrae tutti gli header della richiesta HTTP
apache_response_headers --  Estrae tutti gli header della risposta HTTP
apache_setenv -- Imposta una variabile Apache subprocess_env
ascii2ebcdic -- Traduce una stringa da ASCII a EBCDIC
ebcdic2ascii -- Traduce una stringa da string EBCDIC ad ASCII
getallheaders -- Estrae tutti gli header della richiesta HTTP
virtual -- Esegue una sotto-richiesta Apache


add a note add a note User Contributed Notes
Funzioni Apache
lp at orangecoder dot dk (no fruits!)
03-Nov-2003 12:38
You could do that with a simple:
<?php
if (strlen($_SERVER['PATH_INFO']) > 0)
{
  
header("location: $_SERVER[SCRIPT_NAME]?$_SERVER[QUERY_STRING]");
}
?>
Also, in Apache2 you can set AcceptPathInfo to off (it might even be off as default)...
However, you should give full URIs to your stylesheets etc ;)
realto619 at hotmail dot com
09-Sep-2003 12:25
It looks like this thread hasn't had much activity since late last year, but I thought that I would add my 2¢. I'm new to PHP, but I would think that this problem could be solved by creating a 404 error page that contains the following code

<?php
If (strstr($HTTP_REFERER,".php/"))
{
$Go2URL = ereg_replace (".php/",".php", $HTTP_REFERER);
header("location $Go2URL") ;
}
?>

I didn't test it, but I'm pretty sure that or something similar would do the trick

Realto
crikou at xsilence dot net
12-Apr-2003 10:11
In reply to henk_nicolai, who is talking about the annoying apache behaviour.
First, thanks for your help nicolai.
I've been testing your script, but finally decide to use this one :

if (strstr(strstr($_SERVER['REQUEST_URI'],".php"), "/")) {
header ('Location: 'http://' .$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);
exit();
}

As apache is working on the first ".php" extension it finds, any slashes found after the extension is not welcome, and shouldnt be there (except if you have already implemented a / parser for beautiful urls)
So I guess this little code always works

Hope this helps !
henk_nicolai at REMOVE-THIS at hotmail dot com
20-Nov-2002 10: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 09: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 09:12
Many of the environment variables can be found here:
http://www.php.net/manual/language.variables.predefined.php

<Guida Funzioniapache_child_terminate>
 Last updated: Sun, 02 May 2004
show source | credits | sitemap | contact | advertising | mirror sites 
Copyright © 2001-2004 The PHP Group
All rights reserved.
This mirror generously provided by: Italia OnLine S.p.a.
Last updated: Fri May 21 04:11:23 2004 CEST