Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it possible to set PHP max_execution_time back to server default?

I have a script which generates a CSV file with what might be a large dataset, so I increase the PHP max_execution_time.

Is there a way to reset max_execution_time to the system default either via a function or by reading the default first, increasing the value, then resetting to the default?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

ini_restore('max_execution_time');

The documentation for that is here:

https://www.php.net/manual/en/function.ini-restore.php

If you want to get the original setting you can use ini_get('max_execution_time')

To echo that to the command line you could do the following:
echo 'Current value for \'max_execution_time\': ' . ini_get(max_execution_time), PHP_EOL;

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading