PHP. ini php. INI
Php. ini is used to set the configuration items of PHP. The configuration file (php. ini) is read When PHP is started. For PHP of the server module version, it is read only once when the web server is started. For CGI and CLI versions, each call will read.
The Web servers, CGI, and CLI mentioned here are all PHP runtime environments, that is, SAPI. The SAPI name is obtained using the kernel predefined constant PHP_SAPI or php_sapi_name.
Detailed configuration (http://php.net/manual/zh/ini.list.php)
How to set
Ini_set ()
Note which configurations are available at runtime
Not all INI options can be set through ini_set. There are several modes to distinguish
PHP_INI _ * mode definition
Mode |
Description |
PHP_INI_USER |
It can be set in user scripts (such as ini_set (), Windows Registry (since PHP 5.3), and. user. ini. |
PHP_INI_PERDIR |
It can be set in php. ini,. htaccess or httpd. conf. |
PHP_INI_SYSTEM |
It can be set in php. ini or httpd. conf. |
PHP_INI_ALL |
Can be set anywhere |
Where can I find the php. ini file?
Command line execution in Linux
php -i | grep php.ini
You will get Configuration File (php. ini) Path =>/usr/local/php/etcLoaded Configuration File =>/usr/local/php/etc/php. ini
Phpinfo () find Loaded Configuration File
Common Configuration Items
Configuration item |
Default value |
Description |
Dispay_errors |
"On" |
Whether to output information or hide or not. Note that the tone set during running cannot be obtained if a fatal error occurs. |
Error_reporting |
NULL |
PHP error reporting level |
Memory_limit |
128 M" |
PHP script execution memory limit, note that when set to a number, the unit is byte |
Max_execution_time |
"30" |
The maximum execution time of the script, in seconds. when you run PHP from the command line, the default value is 0. |
Post_max_size |
"8 M" |
The maximum size of POST data. this setting also affects the maximum size of uploads. Therefore, the value must be greater than upload_max_filesize. |
Upload_max_filesize |
"2 M" |
Maximum upload limit |
Session. gc_maxlifetime |
"1440" |
Unit: Seconds. the SESSION expiration time is also related to session. gc_probability and session. gc_pisor. Refer to laruence's article "How to set up a strict 30-minute overdue Session" (http://www.laruence.com/2012/01/10/2469.html) |