Бписок Ρ€Π°Π·Π΄Π΅Π»ΠΎΠ² php.ini

Π’ этом спискС ΡƒΠΊΠ°Π·Π°Π½Ρ‹ Ρ€Π°Π·Π΄Π΅Π»Ρ‹, Π² ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Ρ… Π²Ρ‹ ΠΌΠΎΠΆΠ΅Ρ‚Π΅ Π½Π°ΡΡ‚Ρ€ΠΎΠΈΡ‚ΡŒ PHP Π² зависимости ΠΎΡ‚ хоста ΠΈΠ»ΠΈ ΠΏΡƒΡ‚ΠΈ. Π­Ρ‚ΠΈ Ρ€Π°Π·Π΄Π΅Π»Ρ‹ Π½Π΅ΠΎΠ±ΡΠ·Π°Ρ‚Π΅Π»ΡŒΠ½Ρ‹.

Π”Π°Π½Π½Ρ‹Π΅ Ρ€Π°Π·Π΄Π΅Π»Ρ‹ Π½Π΅ ΠΈΠΌΠ΅ΡŽΡ‚ прямого влияния Π½Π° PHP. Они Π½ΡƒΠΆΠ½Ρ‹ для Π³Ρ€ΡƒΠΏΠΏΠΈΡ€ΠΎΠ²ΠΊΠΈ Π΄Ρ€ΡƒΠ³ΠΈΡ… Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΈΠ² php.ini вмСстС ΠΈ для возмоТности Π΄Π΅ΠΉΡΡ‚Π²ΠΎΠ²Π°Ρ‚ΡŒ Π² зависимости ΠΎΡ‚ ΠΎΠΏΡ€Π΅Π΄Π΅Π»Ρ‘Π½Π½ΠΎΠ³ΠΎ хоста ΠΈΠ»ΠΈ ΠΏΡƒΡ‚ΠΈ.

Π”Π°Π½Π½Ρ‹Π΅ Ρ€Π°Π·Π΄Π΅Π»Ρ‹ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΡŽΡ‚ΡΡ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Π² Ρ€Π΅ΠΆΠΈΠΌΠ΅ CGI/FastCGI ΠΈ Π² Π½ΠΈΡ… Π½Π΅ ΠΌΠΎΠ³ΡƒΡ‚ Π±Ρ‹Ρ‚ΡŒ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Π½Ρ‹ Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΈΠ²Ρ‹ extension ΠΈ zend_extension.

Π Π°Π·Π΄Π΅Π»Ρ‹
НазваниС ΠœΠ΅ΡΡ‚ΠΎ измСнСния Π˜ΡΡ‚ΠΎΡ€ΠΈΡ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠΉ
[HOST=] INI_SYSTEM Β 
[PATH=] INI_SYSTEM Β 

ΠšΡ€Π°Ρ‚ΠΊΠΎΠ΅ Ρ€Π°Π·ΡŠΡΡΠ½Π΅Π½ΠΈΠ΅ ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΎΠ½Π½Ρ‹Ρ… Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΈΠ².

[HOST=<host>]

Π”Π°Π½Π½Ρ‹ΠΉ Ρ€Π°Π·Π΄Π΅Π» позволяСт ΠΎΠΏΡ€Π΅Π΄Π΅Π»ΡΡ‚ΡŒ Π½Π°Π±ΠΎΡ€ php.ini Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΈΠ², ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ Π±ΡƒΠ΄ΡƒΡ‚ ΠΏΡ€ΠΈΠΌΠ΅Π½ΡΡ‚ΡŒΡΡ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ ΠΊ ΡƒΠΊΠ°Π·Π°Π½Π½ΠΎΠΌΡƒ хосту.

ΠŸΡ€ΠΈΠΌΠ΅Ρ€ #1 Активация ΠΏΠΎΠ»Π½ΠΎΠ³ΠΎ логирования ΠΈ сообщСния ΠΎΠ± ΠΎΡˆΠΈΠ±ΠΊΠ°Ρ… для dev. Π΄ΠΎΠΌΠ΅Π½Π°

[HOST=dev.site.com]
error_reporting = E_ALL
display_errors = On
[PATH=<path>]

Π”Π°Π½Π½Ρ‹ΠΉ Ρ€Π°Π·Π΄Π΅Π» позволяСт ΠΎΠΏΡ€Π΅Π΄Π΅Π»ΡΡ‚ΡŒ Π½Π°Π±ΠΎΡ€ php.ini Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΈΠ², ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ Π±ΡƒΠ΄ΡƒΡ‚ ΠΏΡ€ΠΈΠΌΠ΅Π½ΡΡ‚ΡŒΡΡ, Ссли скрипт Π±ΡƒΠ΄Π΅Ρ‚ Π·Π°ΠΏΡƒΡ‰Π΅Π½ ΠΈΠ· ΡƒΠΊΠ°Π·Π°Π½Π½ΠΎΠ³ΠΎ ΠΏΡƒΡ‚ΠΈ.

ΠŸΡ€ΠΈΠΌΠ΅Ρ€ #2 Π”ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ скрипта бСзопасности для Π·Π°Ρ‰ΠΈΡ‰Ρ‘Π½Π½Ρ‹Ρ… Π·ΠΎΠ½

[PATH=/home/site/public/secure]
auto_prepend_file=security.php
οΌ‹Π”ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ

ΠŸΡ€ΠΈΠΌΠ΅Ρ‡Π°Π½ΠΈΡ ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Π΅ΠΉ 8 notes

up
9
public at grik dot net ΒΆ
16 years ago
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).
up
4
robinhook at mail dot com ΒΆ
8 years ago
this HOST and PATH sections doesn't seems to work in php.ini under apache 2.4 with php-fpm 7.1.16 for directive php_value or php_admin_value open_basedir or include_path.
phpinfo() says "none" in master and local values.
up
4
crash at lubyte dot de ΒΆ
15 years ago
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.
up
2
dasloch at absatzen dot de ΒΆ
6 years ago
Note that you cannot usefully set syslog.* in [PATH=] (and probably [HOST=]) sections, since the syslogger is initialized only once per php-fpm worker process, and not per request.
up
2
robinhook at mail dot com ΒΆ
8 years ago
Sorry for the note. I've read some bad tutorials.
The correct syntax is : directive = 'value'
not a thing like : php_value[directive] = "somevalue"
up
3
leo ΒΆ
15 years ago
Just developed the probably first php.ini hack to add commands which will only be parsed before PHP 5.3 when using mod_php.

<?php

# Disable eAccelerator by default
eaccelerator.enable = 0

# Now, to prevent incompatibilities with Zend Optimizer+, we
# want to enable eAccelerator only in PHP 5.2 or lower.
[HOST=*]
eaccelerator.enable = 1

?>

What is happening here? In PHP 5.3, php.ini sections to set up PHP on a per host basis have been introduced:

http://www.php.net/manual/en/ini.sections.php

These sections only work in CGI/FastCGI mode, however there still seems to be a difference in how the php.ini file is parsed in PHP 5.2 and PHP 5.3 when using mod_php: PHP 5.3 ignores everything below the line [HOST=*], whereas PHP 5.2 does not.

In the above example, PHP 5.3 only reads "eaccelerator.enable = 0" and then stops at the invalid command [HOST=*]. However, PHP 5.2 seems to ignore the invalid command and parses the whole configuration file, ending up with "eaccelerator.enable = 1".
up
2
z dot himdi at bita dot nl ΒΆ
14 years ago
On Windows IIS 7 server I noticed that [PATH=] was not listened to. [HOST=] however worked.
up
0
robert dot johnson at icap dot com ΒΆ
16 years ago
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.