Important
Notes: I've never made
changes to a configuration file before, what am I looking
at?
What
are some of the most common settings in
php.ini?
******Before making any changes to your
php.ini file be sure to make a backup******
What is
php.ini?
Simply put, the php.ini file is the configuration
file that tells PHP how to operate. There are many options in the php.ini
file which are covered below.
If
you've never edited a configuration file before, the php.ini file can look
a bit intimidating. As a general rule of thumb, if you do not know what an
option does, leave it alone. Also, you'll see many lines that start with a
semicolon ';'. The semicolon means that the line is ignored and the option
is not read by PHP.
Heres an
example of an option that is commented
out:
The
'open_basedir' option will not be read by the php.ini file, it's as if the
open_basedir option is not there.
safe_mode - This
setting is primarily intended to provide file access limits to prevent users
from accessing files that do no belong to them. This supposedly should make it
impossible to access files of other people in a shared server environment. The
are several problems with safe_mode. Many scripts and content management
programs (joomla or wordpress) are unable to operate with it turned on. The
value for this options is boolean, meaning it should either be set to 'On' or
'Off'.
error_reporting - Error
reporting can be very useful to a developer working on a new script. However,
by enabling this option you're broadcasting a lot of sensitive information to
users. This information can be used to attack or compromise your server. Error
reporting should only be turned on if you are in the process of developing.
For production servers we recommend that you leave this feature off and
instead use error logging. See below for more information on error logging and
the options that can be used:
Typically, if you're in development you
can use the following value to turn on reporting:
E_ALL - All errors
and warnings (doesn't include E_STRICT)
log_errors - This
option saves all errors to a log file rather than sending the error to the
users web browser. This is a much safer option than error_reporting for
production servers. The value for this options is boolean, meaning it should
either be set to 'On' or 'Off'.
Example: error_log =
/var/log/php_error_log
register_globals - By default
this option is set to "Off". In most circumstances it should remain "Off"
because of the security vulnerabilities associated with this option. You
should try your hardest during development to ensure that you don't require
register_globals to be on. However, sometimes there is a need to enable this
selection. The value for this options is boolean, meaning it should either be
set to 'On' or 'Off'.
file_uploads-
This option simply determines whether or not to allow HTTP file uploads. The
value for this options is boolean, meaning it should either be set to 'On' or
'Off'.