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

 About This Book

Introduction and Installation of PHP 7.0

 What Is PHP?

 Downloading and Installing PHP 7.0 for Windows

 "php -help" - Command Line Options

 "php -m" - Built-in Modules

 "php -i" - PHP Engine Information

php.ini - PHP Runtime Configuration

 Hello.php - My First PHP Script

 Downloading and Installing PHP Documentation

 PHP Script File Syntax

 PHP Data Types and Data Literals

 Variables, References, and Constants

 Expressions, Operations and Type Conversions

 Conditional Statements - "if" and "switch"

 Loop Statements - "while", "for", and "do ... while"

 Function Declaration, Arguments, and Return Values

 Arrays - Ordered Maps

 Configuring and Sending out Emails

 Retrieving Information from HTTP Requests

 Creating and Managing Sessions in PHP Scripts

 Sending and Receiving Cookies in PHP Scripts

 Controlling HTTP Response Header Lines in PHP Scripts

 MySQL Server Connection and Access Functions

 Functions to Manage Directories, Files and Images

 SOAP Extension Function and Calling Web Services

 SOAP Server Functions and Examples

 Localization Overview of Web Applications

 Using Non-ASCII Characters in HTML Documents

 Using Non-ASCII Characters as PHP Script String Literals

 Receiving Non-ASCII Characters from Input Forms

 "mbstring" Extension and Non-ASCII Encoding Management

 Managing Non-ASCII Character Strings with MySQL Servers

 Introduction of Class and Object

 Integrating PHP with Apache Web Server

 Outdated Tutorials

 References

 PDF Printing Version