PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<Function Referenceapache_child_terminate>
view the version of this page
Last updated: Thu, 21 Aug 2003

I. Apache-specific Functions

Introduction

These functions are only available when running PHP as an Apache 1.x module.

Installation

For PHP installation on Apache 1.x see the Apache section in the installation chapter.

Runtime Configuration

The behaviour of the Apache PHP module is affected by settings in php.ini. Configuration settings from php.ini may be overridden by php_flag settings in the server configuration file or local .htaccess files.

Example 1. Turning off PHP parsing for a directory using .htaccess

php_flag engine off

Table 1. Apache configuration options

NameDefaultChangeableFunction
engineOnPHP_INI_ALLturns PHP parsing on or off
child_terminateOffPHP_INI_ALL specify whether PHP scripts may request child process termination on end of request, see also apache_child_terminate()
last_modifiedOffPHP_INI_ALLsend PHP scripts modification date as Last-Modified: header for this request
xbithackOffPHP_INI_ALLparse files with executable bit set as PHP regardles of their file ending

Here's a short explanation of the configuration directives.

engine boolean

This directive is really only useful in the Apache module version of PHP. It is used by sites that would like to turn PHP parsing on and off on a per-directory or per-virtual server basis. By putting engine off in the appropriate places in the httpd.conf file, PHP can be enabled or disabled.

Resource Types

This extension has no resource types defined.

Predefined Constants

This extension has no constants defined.

Table of Contents
apache_child_terminate -- Terminate apache process after this request
apache_lookup_uri --  Perform a partial request for the specified URI and return all info about it
apache_note -- Get and set apache request notes
apache_request_headers -- Fetch all HTTP request headers
apache_response_headers --  Fetch all HTTP response headers
apache_setenv -- Set an Apache subprocess_env variable
ascii2ebcdic -- Translate string from ASCII to EBCDIC
ebcdic2ascii -- Translate string from EBCDIC to ASCII
getallheaders -- Fetch all HTTP request headers
virtual -- Perform an Apache sub-request


add a note add a note User Contributed Notes
Apache-specific Functions
realto619 at hotmail dot com
09-Sep-2003 08: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
13-Apr-2003 06: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 08: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 07: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 07:12
Many of the environment variables can be found here:
http://www.php.net/manual/language.variables.predefined.php

<Function Referenceapache_child_terminate>
 Last updated: Thu, 21 Aug 2003
show source | credits | sitemap | mirror sites 
Copyright © 2001-2003 The PHP Group
All rights reserved.
This mirror generously provided by: http://php.mirrors.ilisys.com.au/
Last updated: Sat 01 Nov 2003 04:13:36 EST EST