X
  1. Home
  2. Developer tools
  3. How do I get long-running PHP processes to finish executing?

How do I get long-running PHP processes to finish executing?

Sometimes you may have PHP processes that need an extra long time to finish, and then you usually adjust the settings for max_execution_time and max_input_time in the PHP settings (Select PHP version in cPanel -> Options tab).

However, this is not always enough, and you still get timeouts on your scripts – for example, if you have a large webshop and want to export all orders and/or products.

What you can do is to tell LSWS (LiteSpeed Web Server), our alternative to Apache that runs on all servers for web hosting accounts and on Managed Servers that have selected LSWS as an add-on, to keep processes alive for as long as possible.

The easiest way to do this is to put the following code at the top of the .htaccess file for the site in question:

<IfModule Litespeed> 
    RewriteEngine On
    RewriteRule .* - [E=noabort:1, E=noconntimeout:1]
</IfModule> 

The .htaccess file can be edited via cPanel’s File Manager or via SSH/FTP.

For more information on this solution and its variants, please refer to the official documentation.

Was this article helpful?

Related Articles