How to solve phpini_set function invalidation _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
The phpini_set function is invalid. how can this problem be solved. You can use ini_set to quickly modify php. ini configuration settings, no need to open php. ini is enough, especially when you do not modify php on the VM. when ini is authorized, you will find that the function can be quickly modified using ini_set. ini configuration settings, no need to open php. ini is enough, especially when you do not modify php on the VM. the role of this function will be discovered when ini is authorized. for ini_set, post_max_size, upload_max_filesize, magic_quotes_gpc, and other solutions that cannot be set with ini_set!
The code is as follows:

Ini_set ('max _ execution_time ', '10 ′);
Ini_set ('memory _ limit ', '1024m ');

Echo 'max _ execution_time = '. ini_get ('max _ execution_time ')."
";
Echo 'memory _ limit = '. ini_get ('memory _ limit ')."
";
Echo 'post _ max_size = '. ini_get ('post _ max_size ')."
";
Echo 'upload _ max_filesize = '. ini_get ('upload _ max_filesize ')."
";

Ini_set ('max _ execution_time ', '10 ′);
Ini_set ('memory _ limit ', '1024m ');

Note:

Post_max_size and upload_max_filesize cannot be modified using the following method.
Ini_set ('post _ max_size ', '1024m ');
Ini_set ('upload _ max_filesize ', '1024m ');

The correct method is to use the. htaccess file:

The code is as follows:

Php_value upload_max_filesize "80 m"
Php_value post_max_size "80 m"
Php_value max_execution_time "2000 ″
Php_value memory_limit "150M"

Set max_execution_time for the instance

The code is as follows:

$ Old_max_execution_time = ini_set ('max _ execution_time ', 120 );
Echo "old timeout is $ old_max_execution_time
";

$ Max_execution_time = ini_get ('max _ execution_time ');
Echo "new timeout is $ max_execution_time
";



Echo 'function sets supported in this install are:
';
$ Extensions = get_loaded_extensions ();
Foreach ($ extensions as $ each_ext)
{
Echo "$ each_ext
";
Echo'

    ';
    $ Ext_funcs = get_extension_funcs ($ each_ext );
    Foreach ($ ext_funcs as $ func)
    {
    Echo"
  • $ Func
  • ";
    }
    Echo'
';
}
?>

Additional knowledge points:

In fact, the php document shows that the modifiable range of upload_max_filesize is PHP_INI_PERDIR.
PHP_INI_PERDIR indicates that the domain commands can be modified in the php. ini, httpd. conf, or. htaccess files.
Commands in the PHP_INI_SYSTEM domain can be modified in the php. ini and httpd. conf files.
Therefore, upload_max_filesize cannot be modified with int_set. You can use int_set to modify the value of PHP_INI_ALL.

Magic_quotes_gpc is obtained using get_magic_quotes_gpc () and cannot be modified using set_magic_quotes_gpc because this function is unavailable. Magic_quotes_runtime can be set using set_magic_quotes_runtime ().

...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.