Home > Article > Backend Development > What to do if PHP ini_set doesn't work
Solution to PHP ini_set not working: 1. Modify the htaccess file; 2. Configure "AllowOverride All" in httpd.conf.
The operating environment of this article: Windows 7 system, PHP version 7.1, Dell G3 computer.
What should I do if PHP ini_set does not work?
The reason why PHP ini_set() is invalid:
In PHP configuration, post_max_size and upload_max_filesize cannot be modified using the ini_set() method.
The correct approach is to use the .htaccess file:
php_value upload_max_filesize 1024M php_value post_max_size 1024M
To make the .htaccess file take effect, you need to configure the site in httpd.conf: AllowOverride All
Reason: the modifiable range of upload_max_filesize It is PHP_INI_PERDIR, which can be modified in php.ini, httpd.conf or .htaccess files, but cannot be modified with ini_set().
Knowledge points:
PS:
magic_quotes_gpc is obtained with get_magic_quotes_gpc() and cannot be modified with set_magic_quotes_gpc because there is no such function.
And magic_quotes_runtime can be set with 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!