Π€Π°ΠΉΠ»Ρ .user.ini
ΠΠΊΠ»ΡΡΠ΅Π½Π° ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΊΠ° INI-ΡΠ°ΠΉΠ»ΠΎΠ² Π² ΡΡΠΈΠ»Π΅ .htaccess Π½Π°
ΡΡΠΎΠ²Π½Π΅ ΠΊΠ°ΡΠ°Π»ΠΎΠ³Π°. ΠΡΠΈ ΡΠ°ΠΉΠ»Ρ ΠΎΠ±ΡΠ°Π±Π°ΡΡΠ²Π°ΡΡΡΡ ΡΠΎΠ»ΡΠΊΠΎ CGI/FastCGI SAPI.
ΠΡΠ° ΡΡΠ½ΠΊΡΠΈΡ Π΄Π΅Π»Π°Π΅Ρ Π½Π΅Π½ΡΠΆΠ½ΡΠΌ ΠΌΠΎΠ΄ΡΠ»Ρ PECL htscanner.
ΠΡΠ»ΠΈ PHP ΡΠ°Π±ΠΎΡΠ°Π΅Ρ ΠΊΠ°ΠΊ ΠΌΠΎΠ΄ΡΠ»Ρ Apache, ΡΠΎ Π΄Π»Ρ Π΄ΠΎΡΡΠΈΠΆΠ΅Π½ΠΈΡ ΡΠΎΠ³ΠΎ ΠΆΠ΅ ΡΡΡΠ΅ΠΊΡΠ°,
ΡΠ°Π±ΠΎΡΠ°ΡΡ Ρ ΡΠ°ΠΉΠ»Π°ΠΌΠΈ .htaccess.
Π Π΄ΠΎΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ ΠΊ ΠΎΡΠ½ΠΎΠ²Π½ΠΎΠΌΡ ΡΠ°ΠΉΠ»Ρ php.ini PHP ΠΈΡΠ΅Ρ INI-ΡΠ°ΠΉΠ»Ρ Π² ΠΊΠ°ΠΆΠ΄ΠΎΠΉ
Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΈ, Π½Π°ΡΠΈΠ½Π°Ρ Ρ Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΈ Π·Π°ΠΏΡΠΎΡΠ΅Π½Π½ΠΎΠ³ΠΎ PHP-ΡΠ°ΠΉΠ»Π° ΠΈ ΠΏΡΠΎΠ΄ΠΎΠ»ΠΆΠ°Π΅Ρ
ΠΏΠΎΠΈΡΠΊ Π΄ΠΎ ΠΊΠΎΡΠ½Π΅Π²ΠΎΠΉ Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΈ (ΡΡΡΠ°Π½ΠΎΠ²Π»Π΅Π½Π½ΠΎΠΉ Π²
ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ΅ $_SERVER['DOCUMENT_ROOT']). ΠΡΠ»ΠΈ PHP-ΡΠ°ΠΉΠ» Π»Π΅ΠΆΠΈΡ
Π²Π½Π΅ ΠΊΠΎΡΠ½Π΅Π²ΠΎΠΉ Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΈ, ΡΠΎ ΡΠΊΠ°Π½ΠΈΡΡΠ΅ΡΡΡ ΡΠΎΠ»ΡΠΊΠΎ Π΅Π³ΠΎ Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΡ.
Π’ΠΎΠ»ΡΠΊΠΎ INI-Π½Π°ΡΡΡΠΎΠΉΠΊΠΈ
Ρ ΡΠ΅ΠΆΠΈΠΌΠ°ΠΌΠΈ INI_PERDIR
ΠΈ INI_USER ΡΠ°ΡΠΏΠΎΠ·Π½Π°ΡΡΡΡ Π² INI-ΡΠ°ΠΉΠ»Π°Ρ
Π² ΡΡΠΈΠ»Π΅ .user.ini.
ΠΠ²Π΅ Π½ΠΎΠ²ΡΡ
INI-Π΄ΠΈΡΠ΅ΠΊΡΠΈΠ²Ρ β
user_ini.filename
ΠΈ user_ini.cache_ttl β
ΠΊΠΎΠ½ΡΡΠΎΠ»ΠΈΡΡΡΡ ΡΠ°Π±ΠΎΡΡ Ρ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»ΡΡΠΊΠΈΠΌΠΈ INI-ΡΠ°ΠΉΠ»Π°ΠΌΠΈ.
ΠΠΈΡΠ΅ΠΊΡΠΈΠ²Π° user_ini.filename ΡΡΡΠ°Π½Π°Π²Π»ΠΈΠ²Π°Π΅Ρ ΠΈΠΌΡ ΡΠ°ΠΉΠ»Π°,
ΠΏΠΎ ΠΊΠΎΡΠΎΡΠΎΠΌΡ PHP ΠΏΡΠΎΠΈΠ·Π²ΠΎΠ΄ΠΈΡ ΠΏΠΎΠΈΡΠΊ Π² ΠΊΠ°ΠΆΠ΄ΠΎΠΉ Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΈ; Π΅ΡΠ»ΠΈ ΡΡΡΠ°Π½ΠΎΠ²ΠΈΠ»ΠΈ ΠΏΡΡΡΡΡ ΡΡΡΠΎΠΊΡ, PHP Π½Π΅ ΠΏΡΠΎΠΈΠ·Π²ΠΎΠ΄ΠΈΡ ΠΏΠΎΠΈΡΠΊ.
ΠΠ½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ ΡΠΌΠΎΠ»ΡΠ°Π½ΠΈΡ β .user.ini.
ΠΠΈΡΠ΅ΠΊΡΠΈΠ²Π° user_ini.cache_ttl ΡΡΡΠ°Π½Π°Π²Π»ΠΈΠ²Π°Π΅Ρ,
Π½Π°ΡΠΊΠΎΠ»ΡΠΊΠΎ ΡΠ°ΡΡΠΎ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»ΡΡΠΊΠΈΠ΅ INI-ΡΠ°ΠΉΠ»Ρ Π±ΡΠ΄ΡΡ ΠΎΠ±Π½ΠΎΠ²Π»ΡΡΡΡΡ. ΠΠΎ ΡΠΌΠΎΠ»ΡΠ°Π½ΠΈΡ ΠΏΠ΅ΡΠΈΠΎΠ΄ ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ΠΈΡ
ΡΠΎΡΡΠ°Π²Π»ΡΠ΅Ρ 300 ΡΠ΅ΠΊΡΠ½Π΄ (5 ΠΌΠΈΠ½ΡΡ).
philsward at gmail dot com ΒΆ13 years ago
If you have no idea what "PHP_INI_PERDIR" or "PHP_INI_USER" are or how they relate to setting a .user.ini file, take a look at the ini.list page: http://www.php.net/manual/en/ini.list.php
Basically, anything in the "Changeable" column labeled as PHP_INI_SYSTEM can't be set in the .user.ini file (so quit trying). It can ONLY be set at the main php.ini level.
Anteaus at thenox dot com ΒΆ11 years ago
"If you are using Apache, use .htaccess files for the same effect."
To clarify, this applies only to Apache module mode. If you put php directives in .htaccess on an Apache CGI/FastCGI server, this will bomb the server out with a 500 error. Thus, you unfortunately cannot create a config which caters for both types of hosting, at least not in any straightforward way.
Anonymous ΒΆ6 years ago
Since the .user.ini is read from public directories, it's contents will be served to anyone requesting it and potientially show them sensitive configuration settings.
Add these lines to your .htaccess to block requests to it :
<Files ".user.ini">
Require all denied
</Files>
mark at manngo dot net ΒΆ3 years ago
Trap for young players, not that Iβm such a young player myself.
The default setting for user_ini.cache_ttl is 300 seconds, which means that it refreshes every 5 minutes. If you are tweaking the settings in .user.ini, it could take up to 5 minutes before you see the results of your experimentation.
If you donβt have access to php.ini where you can change this setting, you will have to learn to be very patient.
signups at altillc dot com ΒΆ6 years ago
For those looking for an example... .user.ini should be formatted as a simple list of [KEY]=[VALUE]\n sets. For example, a one-line .user.ini file that serves solely to change the max allowable upload file size to 5Mb is:
upload_max_filesize="5M"
interfaSys ΒΆ15 years ago
This article should be made clearer.
".htaccess-style INI files" meant to me that the ini settings had to follow the syntax used in .htaccess, but this is not the case!
You have to use
register_globals=on
and not
php_flag register_globals on
Also, the changes can take a while to propagate to all processes if you have a long process time out.
Restarting php-fpm can give you an answer quicker :)