Reputation: 232
Is there any method to change php's config when it's running? My business requirement is on FunctionA start turn up it's max_execution_time
and on FunctionA finish turn down it.
Upvotes: 0
Views: 134
Reputation: 5701
Yes:
<?php
function functionA ()
{
if (!ini_get('max_execution_time') || ini_get('max_execution_time') != 3000)
{
ini_set('max_execution_time', 3000); //300 seconds = 5 minutes
}
// Do some things....
}
echo ini_get('max_execution_time'); // We return system default
functionA ();
echo ini_get('max_execution_time'); will return 3000
Beware that some host disable this ability. If thats the case and it is still needed you will need to contact your host to enable it or move hosting companies.
Upvotes: 2