|
PODRĘCZNIK PHP 5.x, 4.x, 3.x - częściowo spolszczony / źródło: www.php.net
[Spis]
[A]
[B]
[C]
[D]
[E]
[F]
[G]
[H]
[I]
[J]
[K]
[L]
[M]
[N]
[O]
[P]
[Q]
[R]
[S]
[T]
[U]
[V]
[X]
[W]
[Z]
ini_set (PHP 4, PHP 5) ini_set -- Sets the value of a configuration option Descriptionstring ini_set ( string varname, string newvalue )
Sets the value of the given configuration option. Returns the old
value on success, FALSE on failure. The configuration option
will keep this new value during the script's execution, and will
be restored at the script's ending.
Not all the available options can be changed using
ini_set(). There is a list of all available options in
the appendix.
See also: get_cfg_var(),
ini_get(),
ini_get_all(), and
ini_restore()
User Contributed NotesRon Ludwig
10-Jan-2006 08:30
When your ISP does not allow you to add the default include directories - it might be useful to extend the 'include_path' variable:
<? ini_set('include_path',ini_get('include_path').':../includes:'); ?>
Alan Hogan
07-Nov-2005 11:26
You can't use ini_set() to turn off register_globals. They've already been registered.
But you can fake it.
<?php
if (ini_get(register_globals)) { foreach ($_GET as $get_key => $get_value) {
if (ereg('^([a-zA-Z]|_){1}([a-zA-Z0-9]|_)*$', $get_key)) {
eval("unset(\${$get_key});");
}
} foreach ($_POST as $post_key => $post_value) {
if (ereg('^([a-zA-Z]|_){1}([a-zA-Z0-9]|_)*$', $post_key)) {
eval("unset(\${$post_key});");
}
} foreach ($_REQUEST as $request_key => $request_value) {
if (ereg('^([a-zA-Z]|_){1}([a-zA-Z0-9]|_)*$', $request_key)) {
eval("unset(\${$request_key});");
}
}
}
?>
(Based on work by Lazur)
simon at welsh dot co dot nz
06-Oct-2005 10:19
To have all errors reported, use
ini_set('error_reporting', E_ALL);
To have none of the errors reported(excludes major ones), use
ini_set('error_reporting', E_NONE);
David Jackson
20-Sep-2005 01:40
You can also find the Apache config files by useing command httpd -V
brainiac5 dot php at aimail dot de
05-Sep-2004 04:54
To find the apache php settings try something like this.
> cd /etc/apache2
> grep -r -n -i safe_mode_exec_dir *.conf
or
> grep -r -n -i safe_mode.*On *.conf
If you find a gererated file, obviously you need to find the source template for it, to change what's needed there.
I just wasted a sunny Sunday on searching for where the heck safe_mode_exec_dir was changed.
And yes, Local Value in phpinfo does mean 'changed between the php.ini file and here', as you would think.
If you have an automated virtual host configuration, such as confixx, php ini values can be spread across very many files.
They can be changed in apache config files, that can have any name, but usually will end on .conf, besides in .htaccess files.
klw at gmx dot at
05-Sep-2004 03:49
To change settings from .htaccess files, it is also required that the directory permissions configured in Apache allow this.
The <Directory /foo/bar> entry in httpd.conf MUST contain "AllowOverride All" or at least "AllowOverride Options" to read PHP settings from the .htaccess file.
E.g. in Fedora Core 2, the default settings for /var/www/html/ are "AllowOverride None", so changing PHP settings via .htaccess for applications installed below /var/www/html/ will not work.
sean at php dot net
14-Aug-2004 03:54
vincent(at)tigroux(dot)net
30-Apr-2004 03:20
Where you want set ini in .htaccess or vhosts directives, if the value of directive is boolean , use php_flag, else if the value is a string use php_value.
Ex : php_value include_path /home/user/include
php_flag zlib.output_compression On
davey at its-explosive dot net
18-Mar-2003 03:42
If you set something using php_admin_value in httpd.conf it is then not possible to be set the value at runtime, even if it's NOT PHP_INI_SYSTEM.
Just an interesting note for Server admins this might come in handy to disable setting of certain things... like allow_url_fopen.
- Davey
miroslav AT simunic DOT de
30-Sep-2002 05:26
|