Get the App
SLTechnology News&Howtos  ›  Development  › 

The solution to the ineffectiveness of ini_set in php

Shulou Source: shulou.com Published: 2022-06-03 19:41:40 11月12日 Update

This article mainly introduces the php ini_set does not work in the solution, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor with you to understand.

The solution that php ini_set does not work: 1, modify the configuration such as post_max_size with ".htaccess" file; 2, configure "AllowOverride All" in "httpd.conf".

Operating environment of this article: Windows7 system, PHP7.1 version, Dell G3 computer

Situations where ini_set doesn't work

Ini_set-sets the value for a configuration option

1. Not all valid options for php.ini can be set with ini_set

two。 Not available when an option can be set, but when the server has a virtual host.

Php ini_set doesn't work?

In PHP configuration, post_max_size,upload_max_filesize cannot be modified with the ini_set () method.

The correct thing to do is to use the .htaccess file:

Php_value upload_max_filesize 1024M php_value post_max_size 1024M

For the .htaccess file to take effect, you need to configure the site in httpd.conf: AllowOverride All

Reason: the modifiable scope of upload_max_filesize is PHP_INI_PERDIR, which can be modified in php.ini,httpd.conf or .htaccess files, but not with ini_set ().

Knowledge points:

Constant value meaning

PHP_INI_USER, 1, configuration options can be set in the user's PHP script or Windows registry

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

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 such function.

Magic_quotes_runtime can be set with set_magic_quotes_runtime ()

Thank you for reading this article carefully. I hope the article "the solution to the ineffectiveness of ini_set in php" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Configuration function available in file article method reason knowledge validity host value practice interest function method at the same time meaning constant situation more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MySQL MariaDB Shulou Technology Microsoft