Max Execution Time of PHP in PHP Script

  • Hello i have set the max_execution Time of PHP to a high level, because some programms on my Web Software can need about 60Seconds to finish the requests.

    But on one Site i need to lower the execution time to about 10Secs.

    It is why on this special site i do a request to another Server, and if this Server is not reachable the request will wait the whole 60Seconds, and Browser hangs so long.

    ini_set('max_execution_time') doesnt work.

    Thanks a lot

    (Sorry for bad english)

  • Imscp latest 1.5.3

    Php 5.6


    The only Question i have, is it possible to setup php that i can use the php function ini_set("max_execution_time") in php script.

    I can use it on php but it isnt working.


  • Pls read my question, then you see your answer is wrong.

    I know the settings in imscp.

    I need the high time value in all php scripts.

    Only in one i need lower value.

    Maybe someone can help.

  • Hello!

    That´s the reason why i ask you about all informations!

    PHP-FPM makes you able to set the values per domain!
    Do you also use our PHPSwitcher Plugin?

    If not, you should be able to change the values for each domain here: /etc/apache2/sites-available/domain.tld.conf
    After you change the value, you have to restart the apache2 service with service apache2 restart

    If you use the PHPSwitcher Plugin, the directory and service is different.

    Best regards

    Support Infos: I-MSCP Version: 1.5.x / Distro: Debian Stretch / PHP: 7.1.27 - FPM / I-MSCP Plugins: Let´s Encrypt + PHPSwitcher (latest Versions)

  • reitbrud

    Assuming* that you're using FPM with the per_site PHP configuration level, and without considering the PhpSwitcher plugin, you need to modify the default FPM pool configuration template file if you want be able to change the max_execution_time INI directive at runtime, using the ini_set() PHP function. Why? Because i-MSCP set the value by default through php_admin_value rather than php_value, meaning that you cannot change the value at runtime. Of course, this is the expected behavior for most hosting providers since they want not let's their customers eat all available resources. That's also why the previous advice from Dylan was to use the PHP Editor to set the value for your customer.

    For instance, by default, you can have such a FPM pool configuration file:

    As you can see here, the max_execution_time INI directive is set with php_admin_value. If you want be able to change the value at runtime, using the ini_set() PHP function, you need set the value with php_value in the FPM pool configuration file instead. Best in your case would be to modifiy the FPM pool configuration template file which is located at: /etc/imscp/php/fpm/pool.conf. Then once done, you should trigger an i-MSCP reconfiguration. Another solution is to make use of the following listener file:… but you would have to modify that listener to set the value with php_value rather than php_admin_value.

    See also for detailed explanation regarding usage of php_admin_value rather than php_value, and all other equivalent.

    BTW: When other people give you an answer, try to stay calm. They only want help you on their free time.

    * Next time please, provide all relevant information, as asked by FloRet88. Else, we can only make assumption...

    Thanks you.


  • Hello!

    Thanks for that.

    But that is all what i still know how to configure my max values aso.

    I want to change per Domain max_execution_time Setting on runtime of code. (PHP ini_set (max_execution_time...)

    That is what i wrote on first Post.

    I use one Domain.

    On this Domain i have set Max Execution time to 60seconds. I need this times to make big sql queries.

    But on one Script i need the execution time set to at about 5 seconds, because I read content from other Website, and if this website isnt reachable or i get no answer i dont want to wait 60seconds to get the max_execution Timeout.

    Maybe my first post was written not clearly.

    Nuxwin: OK that I also checked that ini_set doesnt work. But is there a possibility that I can change the configuration of PHP (I USE also PHP Switcher) to use ini_set?


    I hope you can help me.

  • I hope you can help me.

    All is in my answer. For the PhpSwitcher, read the documentation to know where the file are located. Search a bit.