System Configuration

Now that you have PHP and your web server up and running, you will probably want to configure PHP to your liking. All of PHP's settings are available in its php.ini file, which, if you followed these installation instructions, is available either in /usr/local/lib/php (Unix) or c:\windows\php.ini (Windows). Open this in your text editor of choice (you will need to be root on Unix).

A list of popular options, what they do, and their default values (if you use php.ini-recommended as the default) is given in Table 2-2. Note that lines starting with a semicolon (;) are comments, and are ignored by PHP.

Table 2-2. Configuration options for PHP

Option

Meaning

Default

assert.active

Enables the assert() function

On

display_errors

Sets whether PHP should output error messages to the screen

Off

error_reporting

Decides what types of errors PHP should notify you of

E_ALL

expose_php

Allows PHP to identify itself to clients through the web server

On

extension

Loads a PHP extension

N/A

extension_dir

Sets the directory where PHP should look for extensions

./

file_uploads

Decides whether PHP should accept users uploading files

On

log_errors

Determines whether PHP should store error messages in a log file

On

magic_quotes_gpc

Determines whether PHP should automatically run form data through addslashes() before you get it

Off

max_execution_time

Determines how long a script may run for before timing out

30 seconds

mbstring.func_overload ...

Get PHP in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.