HomeContactLinks

php_value, php_flag, php_admin_value, php_admin_flag

By Flib

2009-05-18

Category: PHP

The Problem

If you change almost any of the PHP setting in php.ini then you affect all vhosts on the server. This can be a bad thing. Scripts may break and functionality may change.

Luckily, there is a more fine grained solution if you are running PHP as a module.

The Solution

These flags only work when PHP is installed as a module on Apache (mod_php), when installed as cgi they are ignored.

These flags are fairly simple in concept but very powerful in use.

Put simply, they allow many of the configuration options listed in php.ini to be set in a vhost section of the apache configuration file or a .htaccess file. Not all options can be in all places this way, only the options not listed as PHP_INI_SYSTEM for example may be set in a .htaccess file for example.

The only real difference between php_value and php_flag is that php_flag is restricted to values of 0 or 1 only, whereas php_value may contain almost any value.

php_admin_value and php_admin flag are directly comparable to php_value and php_flag except for two vital points; the can not be used in .htaccess files and they can not be overridden once set. This is useful for hosting environments where certain values may need to differ between vhosts, but you don't want the users being able to override them.

Further information may be found in the PHP manual.

©2009 AskFlib.com

Powered by TMI-CMS and Technomonk Industries