|
|
I. Apache-spezifische FunktionenEinf�hrung
Diese Funktionen stehen nur zur Verf�gung, wenn PHP als Apache 1.x Modul
l�uft.
Installation
Informationen zur Installation von PHP unter Apache 1.x finden Sie im
Kapitel Installation unter dem
Abschnitt zu Apache
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 1. Parsen von PHP f�r ein Verzeichnis ausschalten mittels .htaccess |
Tabelle 1. Apache Konfigurations Optionen Bezeichnung | Grundeinstellung | �nderbar | Bedeutung |
---|
engine | On | PHP_INI_ALL | Parsen von PHP ein/-auschalten | child_terminate | Off | PHP_INI_ALL |
Gibt an, ob PHP Skripte veranlassen, dass Kindprozesse nach dem Request
beendet werden, siehe auch apache_child_terminate().
| last_modified | Off | PHP_INI_ALL |
Das letzte Datum der �nderung des PHP Skripts wird als
Last-Modified: header f�r diesen Request gesendet.
| xbit_hack | Off | PHP_INI_ALL |
Dateien mit gesetztem ausf�hrbaren Bit werden unabh�ngig
von ihrer Dateiendung durch PHP geparst.
|
Hier eine kurze Erkl�rung der Konfigurationsoptionen:
- engine
boolean
Diese Option ist in erster Linie nur sinnvoll, wenn PHP als
Modul in den Apache einkompiliert wurde. 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 aktiviert bzw. deaktiviert werden.
Resource TypenDiese Erweiterung definiert keine Resource-Typen. Vordefinierte KonstantenDiese Erweiterung definiert keine Konstanten.
User Contributed Notes Apache-spezifische Funktionen |
|
jarl at diku dot dk
25-Mar-2000 10:12 |
|
Many of the environment variables can be found here:
|
|
cjm2 at earthling dot net
10-Jan-2002 10: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
|
|
henk_nicolai at REMOVE-THIS at hotmail dot com
20-Nov-2002 11:03 |
|
My Apache server has a problem when someone enters a URI like: ".
(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 (")
reveals that also this site has this glitch.
When a client
requests a directory without the last slash (")
the server sends a HTTP 301 (Moved Permanently) response with a redirect
to the correct URI ("),
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.)
|
|
crikou at xsilence dot net
12-Apr-2003 11: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: '
.$_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 !
|
|
Dhananjay Rokde dhanu1000 at indiatimes dot com
14-Apr-2003 11:29 |
|
###################################### # Configuring Apache for
Windows # ###################################### CAUTION:: 1)
Read the tutorial completly and only then proceed. 2) BackUp the
original Httpd.conf file.
First; install PHP.
Now, you will
unzip the constance of that 5meg file you downloaded. Now create a folder
in C:\Apache2 <ie: the Apache directory> and call it PHP. Now move
the constance of the ziped file to that folder. Now go to your httpd.conf
file. It is in your C:\apache2\conf directory.
Now open that
sucker up with notepad. Be sure to do not add the files in (
)'s
First find the line:
Setting up
Httpd.conf
ScriptAlias /cgi-bin/
"C:/Apache2/cgi-bin/"
Go to the line under it and
insert:
ScriptAlias /php/ "C:/apache2/php/" (what this
does is tell the server where the php folder is)
Now find the
lines:
# Format: Action handler-name
/cgi-script/location
# Go to the line following it and insert
this: Action application/x-httpd-php /php/php.exe (What this does is
tell the server where the php program is)
Now find the
lines:
# AddType allows you to add to or override the MIME
configuration # file mime.types for specific file
types
# AddType application/x-tar .tgz Go to the line
following it and insert these lines: AddType application/x-httpd-php
.php AddType application/x-httpd-php .php3 AddType
application/x-httpd-php .phtml AddType application/x-httpd-php-source
.phps (what this does is like the extensions on files)
Now, look
for
<IfModule mod_mime_magic.c> MIMEMagicFile
conf/magic </IfModule> Now add this below: <IfModule
mod_dir.c> DirectoryIndex index.html index.php default.php
main.php </IfModule>
(What that does is when you go to a
folder, it will go to one of thoes files)
#There is not too much of
risk involved as you can always reinstall the apache software, so take it
easy#
Apache is easily available at:
<Entire List of Mirrors>
|
|
|
| |