RTFM.WIKI

Ordnung muß sein. Ordnung über alles (18+)

Инструменты пользователя

Инструменты сайта


linux:php_value_flag

PHP: php_value vs php_admin_value and the use of php_flag explained

php_flag

When using the php_flag directive in Apache configurations, it's used to set boolean values for options. So only true/false, On/Off, … kind of parameters. For example:

php_flag display_startup_errors off
php_flag display_errors off
...

Those are only On/Off values with which you enable or disable the setting. You can use the php_flag option in Virtual Host configs, .htaccess files and the general Apache configuration. However, you can 't change every configuration value from PHP that way. You can only change the PHP_INI_ALL and PHP_INI_PERDIR options shown on the "List of php.ini directives" page.

php_admin_flag

This can only be used within the Apache configuration (general config or in a Virtual Host) and can not be used in a .htaccess. You can set any kind of php configuration setting that behaves as a boolean this way. For example:

php_admin_flag safe_mode off

By using the php_admin_flag you can not overwrite the setting from within your application using ini_set()! Whatever the value is there, it will remain so during the execution of your applications.

php_value

If php_flag is used for booleans, php_value is used for everything else. Any kind of configuration directive that takes parameters other than On/Off, you can use php_value for. For example:

php_value error_log  /some/dir/to/log/php_errors.log
php_value  upload_max_filesize  10M
...

Just the same as the php_flag, you can not overwrite all configurations this way. Since you can use php_value everywhere (.htaccess, apache configs & virtual host), it would be unsafe. You can only change the PHP_INI_ALL and PHP_INI_PERDIR options shown on the "List of php.ini directives" page.

If you want to clear a configuration value, use the "none" value.

php_value open_basedir none

php_admin_value

This option can only be used in the Apache configuration, not in .htaccess files. It does allow you to overwrite any configuration value possible in PHP.

By using the php_admin_value, the value of that configuration directive cannot be overwritten in the application. That means if you were to set your include_path by using php_admin_value, the application (such as the Zend Framework bootstrap) would not be able to alter the content of that configuration directive via ini_set() or set_include_path().

Only use the php_admin_value if you explicitly want to forbid that configuration directive from being changed by your application.

Сайт rtfm.wiki использует cookies и трекинг посещений. Продолжая использовать этот сайт, вы соглашаетесь с сохранением файлов cookie на вашем компьютере. Если вы не согласны покиньте сайт или включите Adblock 😎 Что такое cookies? 🍪

Обсуждение

Ваш комментарий. Вики-синтаксис разрешён:
 
linux/php_value_flag.txt · Последнее изменение: 2017/12/05 14:36 — 127.0.0.1