PHP Doku:: Liste der php.ini-Abschnitte - ini.sections.html

Verlauf / Chronik / History: (2) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchAppendicesphp.ini EinstellungenListe der php.ini-Abschnitte

Ein Service von Reinhard Neidl - Webprogrammierung.

php.ini Einstellungen

<<Liste der php.ini-Direktiven

Beschreibung der php.ini-Direktiven des Sprachkerns>>

Liste der php.ini-Abschnitte

Diese Liste beinhaltet die php.ini Abschnitte die Sie für die Konfiguration auf Basis des Host- oder Pfadnames nutzen können. Diese Abschnitte sind optional.

Die Abschnitte selbst beeinflussen PHP nicht direkt. Sie werden genutzt um andere php.ini Direktiven zu gruppieren und sie für einen bestimmten Host- oder Pfadnamen anzuwenden.

Abschnitte
Name Änderbar Kommentar
[HOST=] PHP_INI_SYSTEM Hinzugefügt in PHP 5.3.0.
[PATH=] PHP_INI_SYSTEM Hinzugefügt in PHP 5.3.0.

Hier eine kurze Erklärung der Konfigurationsoptionen:

[HOST=<host>]

Dieser Abschnitt gestattet die Definition einer Gruppe von php.ini Direktiven die für einen bestimmten Host Anwendung finden sollen.

Beispiel #1 Aktiviere volle Fehlerausgaben im Browser für die dev. Domain

[HOST=dev.site.com]
error_reporting = E_ALL
display_errors = On

[PATH=<path>]

Dieser Abschnitt gestattet die Definition einer Gruppe von php.ini Direktiven die für einen bestimmten Pfad Anwendung finden sollen.

Beispiel #2 Binde für ein zu sicherndes Verzeichnis ein Sicherheitsscript hinzu

[PATH=/home/site/public/secure]
auto_prepend_file=security.php


4 BenutzerBeiträge:
- Beiträge aktualisieren...
stickman
5.01.2011 10:39
This doesn't seem to work with php-fpm.
The values defined under PATH or HOST will become the new master value for all the processes (as if they were redefined).
crash at lubyte dot de
6.09.2010 14:45
If you have a system which uses separated PHP inis for loading extensions (Debian, Fedora and most other distributions do so), [PATH=] or [HOST=] will prevent loading extensions defined in those ini files (extension= and zend_extension=).

I had some headache, when I added a hosts.ini to /etc/php5/cgi/conf.d (Debians default), where I wanted to define some defaults for a host name. The manual says extension= and zend_extension= aren't allowed in [HOST=] and [PATH=] (see above). I figured out that you can easily fix that with adding [PHP] after your definitions.

For example hosts.ini:
[HOST=dev.example.com]
display_errors = on

[PHP]

this will change the section back to [PHP] where extension= and zend_extension= is allowed.
robert dot johnson at icap dot com
12.04.2010 19:26
Adding PATH= applies only to the named path and does not include sub-directories, you have to add a PATH= value for each sub-directory.

Also some settings have no effect even though phpinfo recognises and displays the per-folder value as the 'local' value, and the default as the 'master' value.

'fastcgi.impersonate' always uses the master setting.
public at grik dot net
25.09.2009 0:00
In [HOST=...] one should use only the 1st server name from the list of server names.

I.E. if you have
server_name example.com, example2.com;
and will use www.example.com in a browser,
use [HOST=example.com] in php.ini for both addresses.

PHP looks not at the HOST request header (as I expected), but at the SERVER_NAME parameter (which by default is the 1st from the list of names, no matter what the HOST is).



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)