PHP Tutorials - Herong's Tutorial Examples - Version 4.17, by Dr. Herong Yang
php.ini - PHP Runtime Configuration
This section describes the PHP runtime configuration file, php.ini.
PHP runtime behavior can be controlled by a runtime configuration file called php.ini in the \php folder. The PHP installation package provides 2 versions of php.ini:
php.ini-development - More secure and better performance php.ini-production - More verbose in error messages
Since we are running PHP on a local machine to learn the PHP language, we should use the php.ini-development version. So let's copy php.ini-development to php.ini:
>copy \php\php.ini-development \php\php.ini 1 file(s) copied. >type \php\php.ini | more [PHP] ;;;;;;;;;;;;;;;;;;; ; About php.ini ; ;;;;;;;;;;;;;;;;;;; ; PHP's initialization file, generally called php.ini, is responsible ; for configuring many of the aspects of PHP's behavior. ; ... ; Name for user-defined php.ini files. Default is ".user.ini" ;user_ini.filename = ".user.ini" ; To disable this feature set this option to empty value ;user_ini.filename = ; TTL for user-defined php.ini files (time-to-live) in seconds. ; Default is 300 seconds (5 minutes) ;user_ini.cache_ttl = 300 ; Enable the PHP scripting language engine under Apache. engine = On ...
As you can see the php.ini file is very easy to use. The ";" character at the beginning of the line indicates a comment line. Configuration settings are provided in the format of "name = value". The default version of php.ini comes with lots of comments to help you understaning what is the meaning of each setting.
For example, if I want to set a default timezone in runtime environment, I can edit php.ini and change the "date.timezone" setting:
>edit \php\php.ini ; Defines the default timezone used by the date functions date.timezone = Europe/Paris
Now the PHP engine will be running with Europe/Paris as the default timezone.
Last update: 2015.
Table of Contents