Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

ini_set

(PHP 4, PHP 5)

ini_set -- Sets the value of a configuration option

Description

string 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(), ini_restore() и How to change configuration settings



main> <ini_restore
Last updated: Fri, 26 Jan 2007
 
add a note add a note User Contributed Notes
ini_set
Joel
07-Nov-2006 08:02
I was having some trouble using include_path in my .htaccess file because I was running PHP and Apache on a windows platform.  The difference is you have to separate paths using the semicolon(;) not the colon (:)
Example:
php_value include_path ".;C:\www\scripts;C:\php\;C:\php\PEAR"
daevid at daevid dot com
30-Oct-2006 05:19
Be careful with setting an output_handler, as you can't use ini_set() to change it. *sigh*

In my php.ini I have this for my web pages (and I want it):

  output_handler = ob_gzhandler

But this causes my command line scripts to not show output until the very end.

#!/usr/bin/php -q
<?php
ini_set
('output_handler', 'mb_output_handler');
echo
"\noutput_handler => " . ini_get('output_handler') . "\n";
?>

root@# ./myscript.php
output_handler => ob_gzhandler

Apparently (acording to Richard Lynch):

> TOO LATE!
> The ob_start() has already kicked in by this point.
> ob_flush() until there are no more buffers.
RebootConcepts.com
31-Mar-2006 01:36
set PHP_INI_PERDIR settings in a .htaccess file with 'php_flag' like this:

php_flag register_globals off
php_flag magic_quotes_gpc on
Ron Ludwig
10-Jan-2006 11: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:');  ?>
David Jackson
20-Sep-2005 04:40
You can also find the Apache config files by useing command httpd -V
brainiac5 dot php at aimail dot de
05-Sep-2004 07: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 06: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
13-Aug-2004 06:54
While this doesn't belong in the manual, it should be useful for people looking on this page for zend_optimizer.* ini options, which are commonly installed:

Information on the "zend_optimizer.optimization_level" and "zend_optimizer.enable_loader" options is available at:

http://www.zend.com/support/user_docs/ZendOptimizer/PDF/ZendOptimizer_UserGuide.pdf
vincent(at)tigroux(dot)net
29-Apr-2004 06: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
17-Mar-2003 06: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
29-Sep-2002 08:26
If it
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com
Z058440144362 Z348613067571