php ini_set does not work solutions: 1. Use the ".htaccess" file to modify post_max_size and other configurations; 2. Configure "AllowOverride All" in "httpd.conf".
The operating environment of this article: Windows7 system, PHP7.1 version, Dell G3 computer
Ini_set does not work
ini_set -- Set a value for a configuration option
1. Not all valid options in php.ini can be set with ini_set;
2. When An option can be set, but it is not available when a virtual host is set on the server.
php ini_set does not take effect?
In PHP configuration, post_max_size and upload_max_filesize cannot be modified using the ini_set() method.
The correct way is to use the .htaccess file:
php_value upload_max_filesize 1024M php_value post_max_size 1024M
To use For the .htaccess file to take effect, the site needs to be configured in httpd.conf: AllowOverride All
Reason: The modifiable range of upload_max_filesize is PHP_INI_PERDIR, which can be modified in php.ini, httpd.conf or .htaccess file, but Cannot be modified with ini_set().
Knowledge point:
Constant value meaning
PHP_INI_USER, 1, configuration options can be in the user's PHP script or Windows registry Set
PHP_INI_PERDIR, 2, configuration options can be configured in php.ini, .htaccess or httpd.conf
PHP_INI_SYSTEM, 4, configuration options can be configured in php.ini or httpd.conf Configuration
PHP_INI_ALL, 7. Configuration options can be set everywhere
PS:
magic_quotes_gpc is obtained with get_magic_quotes_gpc() and cannot be modified with set_magic_quotes_gpc because there is no this function.
And magic_quotes_runtime can be set using set_magic_quotes_runtime()
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What to do if php ini_set doesn't work. For more information, please follow other related articles on the PHP Chinese website!