Home  >  Article  >  Backend Development  >  html - How to set post_max_size and upload_max_filesize in my own php script??

html - How to set post_max_size and upload_max_filesize in my own php script??

WBOY
WBOYOriginal
2016-08-25 10:37:301298browse

How to set the maximum size of uploaded files in your own script? Without modifying the initial configuration of php.ini, ini_set does not seem to take effect on this configuration item! ! !

Reply content:

How to set the maximum size of uploaded files in your own script? Without modifying the initial configuration of php.ini, ini_set does not seem to take effect on this configuration item! ! !

PHP configuration has four modes.

  1. PHP_INI_USER

  2. PHP_INI_PERDIR

  3. PHP_INI_SYSTEM

  4. PHP_INI_ALL

When this configuration is the first or fourth type, you can use ini_set().

And post_max_size and upload_max_filesize are both the second type, so they cannot take effect.

If the subject is using a virtual host, you can change php.ini in the control panel of the virtual host. Most virtual hosts provide these two configuration changes

The modifiable range of these two configurations is PHP_INI_PERDIR, that is, it can only be configured in the configuration file, and the modification of ini_set is invalid.

http://php.net/manual/zh/conf...

Statement:
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