What to do if PHP ini_set doesn't work

藏色散人
Release: 2023-03-14 14:42:01
Original
1618 people have browsed it

Solution to PHP ini_set not working: 1. Modify the htaccess file; 2. Configure "AllowOverride All" in httpd.conf.

What to do if PHP ini_set doesn't work

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
Copy after login

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:

What to do if PHP ini_set doesnt work

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template