Re: Changing PHP.INI Options on the fly ...

From: Date: Tue, 06 Feb 2001 16:20:08 +0000
Subject: Re: Changing PHP.INI Options on the fly ...
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-5416@lists.php.net to get a copy of this message
CodeDuck: From the PHP Manual, Section I.3 Configuration: "The configuration file The configuration file (called php3.ini in PHP 3.0, and simply php.ini as of PHP 4.0) is read when PHP starts up. For the server module versions of PHP, this happens only once when the web server is started. For the CGI version, it happens on every invocation. When using PHP as an Apache module, you can also change the configuration settings using directives in Apache configuration files and .htaccess files. With PHP 3.0, there are Apache directives that correspond to each configuration setting in the php3.ini name, except the name is prefixed by "php3_". With PHP 4.0, there are just a few Apache directives that allow you to change the PHP configuration settings. php_value name value This sets the value of the specified variable. php_flag name on|off This is used to set a Boolean configuration option. php_admin_value name value This sets the value of the specified variable. "Admin" configuration settings can only be set from within the main Apache configuration files, and not from .htaccess files. php_admin_flag name on|off This is used to set a Boolean configuration option. You can view the settings of the configuration values in the output of phpinfo(). You can also access the values of individial configuration settings using get_cfg_var()." Examples: php_value sendmail_from myself@myserver.com php_value SMTP myserver.com So, to change a setting, you would have a script that writes to a .htaccess file on a specified directory and then redirect to a second script that would run from that same directory, using the new settings. .htaccess files are read everytime a request is received from a browser and the requested file is searched for. If you have .htaccess files on all the directories that make up a path to the file, Apache will read and merge all of this and act on the result. For example, if the browser is requesting: /dir1/dir2/dir3/script.php Apache will read the .htaccess file on your htdocs, then the one in /dir1, then the one from /dir1/dir2 and so on until it finds script.php, all the .htaccess files read are merged into one resulting .htaccess and this will determine permissions, settings, etc. for that particular script. I hope all this makes sense. Saludos, Pablo _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Tuesday, February 06, 2001, 4:23:08 AM, Andreas wrote: AL> hi, AL> has anyone a quick-documentation on how to modify php.ini options via AL> Apaches .htaccess. I know, that this is possible (i read it somewhere, AL> but can't remember where). AL> Things i need to changein PHP4 Session Management: AL> - use no cookies. AL> - name of the session. AL> - directory for storing the session-files AL> any help out there? ;) AL> CodeDuck

« previous php.windows (#5416) next »