Where to call the ini_set () functions in a class?

I want to know where it is best to place the ini_set () functions, because I think when the function ini_setis inside the method as follows:

private function archiveBackup() {
    ini_set('memory_limit', '128M');
    ini_set('max_execution_time', 0);
    ...
}

Function ini_setdoesn't work ?!

My script works like this: jQuery ajax query -> ajax.php file (make an instance of the class and call some method) -> call the class method.

Where is the best place? In a file ajax.phpor at the beginning of a class or inside methods?

+5
source share
3 answers

In general, the best place to place calls ini_setis the correct (or near) start of the script. Thus, it is almost the same as if they were defined in the file php.iniin the first place.

+5
source

, ini_set , , , .

:

ini_set ?!

, - - .

Kolink, - disable_functions .

+1

It can be considered as a personal preference, but I personally avoid using any PHP configuration directives outside of the application configuration files. In other words, if a specific class of my project requires a specific configuration at the PHP level, I note this requirement in the class description, but still apply the configuration in my main configuration files.

0
source

All Articles