php.ini
, but it can be located in several different areas. The locations that the PHP server checks are (in order):
- The path set in the
PHPIniDir
directive in the Apache web server configuration file - The path set in a system environment variable named
PHPRC
- For Windows systems, the path set in the registry key named
IniFilePath
under theHKEY_LOCAL_MACHINE/Software/PHP
registry hive - The folder where the PHP server executable file is stored
- The default web server's folder
- The OS system folder, which for Windows is the
c:\winnt folder
, and for Linux and Mac the/usr/local/lib folder
php.ini
file in the c:\xampp\apache\bin
folder.If you're ever in doubt as to which php.ini
configuration file the PHP server is using, run the p
hpinfo() function in a small PHP program. For your convenience, all the popular all-in-one packages provide a link to run the phpinfo()
function from their main web pages. This image shows the output from the phpinfo()
function in XAMPP running on a Windows system.
![phpinfo() function](https://cdn.prod.website-files.com/6634a8f8dd9b2a63c9e6be83/669f7390ad46c6fecb8afd09_phpmysqpjava-phpfunction.jpeg)
phpinfo()
function output.The phpinfo()
function displays the system values for each of the configuration file settings and if any were overridden by a local setting. Look for the Loaded Configuration File entry that shows the path to the active php.ini
file to see where that file is located for your PHP server.
As you can imagine, there are lots of settings available in the php.ini
configuration file. Here are some of the php.ini
settings (and the default values set in XAMPP) that you may need to tweak on your PHP server:
date.timezone = Europe/Berlin
: Defines the time zone of the PHP server. This must use a time zone value defined at http://php.net/manual/en/timezones.php.display_errors = On
: Defines whether PHP error messages appear on the web page. This feature is extremely handy for development work but should be disabled for production servers.error_reporting = E_ALL & ~E_DEPRECATED
: Sets the level of error reporting from the PHP server. PHP uses a complicated bit pattern to set which errors to display or not display. It uses labels to indicate the error level and Boolean bitwise operators to combine the levels — the tilde (~) indicates theNOT
operator. The error levels are:E_ERROR
: Fatal run-time errorsE_WARNING
: Run-time warnings that won't halt the scriptE_PARSE
: Parsing syntax errorsE_NOTICE
: Script encountered something that could be an error and effect the resultsE_CORE_ERROR
: Fatal error that prevents PHP from startingE_CORE_WARNING
: Non-fatal errors during startupE_COMPILE_ERROR
: Fatal error while compiling the PHP codeE_COMPILE_WARNING
: Non-fatal errors during compile timeE_USER_ERROR
: Fatal error message generated manually by your PHP codeE_USER_WARNING
: Non-fatal error message generated manually by your PHP codeE_USER_NOTICE
: Notice message generated manually by your PHP codeE_STRICT
: PHP detected code that doesn't follow the PHP strict rulesE_RECOVERABLE_ERROR
: A fatal error that you can catch with a try-catch blockE_DEPRECATED
: The PHP parser detected code that will no longer be supportedE_USER_DEPRECATED
: A deprecation error generated manually by your PHP codeE_ALL
: All errors and warnings exceptE_STRICT
variables_order = "GPCS"
: The order in which PHP populates the data from the HTTP session (G = GET, P = POST, C = Cookies, and S = System variables)short_open_tag = Off
: Determines if you can use the tag to identify PHP code in your HTML documentsmax_execution_time = 30
: Sets a time limit (in seconds) for a PHP program to run before the PHP server kills it (This is useful for stopping programs stuck in a loop!)memory_limit = 128M
: Sets a limit on how much memory on the physical server the PHP server can allocate (This also helps prevent runaway programs from taking down the entire web server!)