LiteSpeed timeout after 60 minutes in php script

#1
Hi,
I have big probem....
I have on server newest Alma Linux 8 and newest DirectAdmin, Litespeed 6.0.x
I need to have cron job script working more than 60 minutes.... it's not working like I need...script (PHP) in litespeed is ending after 60 minutes everytime.... I need to run it more than 60 minutes...
What I did and it's not working (with your tutorial in your website...):
Cron job command in DA:
Code:
/usr/bin/lynx -dump https://domain.com/crons/script.php > /dev/null 2>/dev/null &
Shell_exec in that above PHP script, I can confirm also max_execution_time is 0 in phpinfo() :

PHP:
 set_time_limit(0);
    ini_set('max_execution_time', 0);
shell_exec(escapeshellcmd('/usr/bin/nohup /usr/bin/lynx -dump ' . $domain . '/crons/script.php > /dev/null 2>&1 &'));
echo date("H:i:s d.m.Y",time()).' - '.$domain.'- done<br>';
.htaccesses in root domain where are both script.php :

Code:
<IfModule Litespeed>
RewriteEngine On
RewriteRule ^crons/script.php?$ - [E=noabort:1, E=noconntimeout:1]
RewriteRule ^script.php?$ - [E=noabort:1, E=noconntimeout:1]
</IfModule>

Anyone have any idea why it's ending after 60 minutes?....
 

serpent_driver

Well-Known Member
#3
There is usually no timeout limit in the console, so you shouldn't have any problems in the console. However, it makes a difference whether the PHP script actually runs as cron or you run the script manually in the console, because then there is a SSH timeout.

Regardless, try this timeout code. This one works.

Code:
SetEnvIf Request_URI "^\/path_to\/script\.php" noabort noconntimeout
 
#4
There is usually no timeout limit in the console, so you shouldn't have any problems in the console. However, it makes a difference whether the PHP script actually runs as cron or you run the script manually in the console, because then there is a SSH timeout.

Regardless, try this timeout code. This one works.

Code:
SetEnvIf Request_URI "^\/path_to\/script\.php" noabort noconntimeout
I run this by cron but in browser ;p so it's like you or me will trigger script in browser.
Where to put this code? in .htaccess? It has to be also between

Code:
<IfModule Litespeed>
</IfModule>
?
 
#7
This one is ok ?
Code:
<IfModule Litespeed>
    SetEnvIf Request_URI "^\/crons\/active_trainings\.cron\.php" noabort noconntimeout
    </IfModule>
Or this ?


Code:
<IfModule Litespeed>
    SetEnvIf Request_URI "^\/crons\/active\_trainings\.cron\.php" noabort noconntimeout
</IfModule>
Because I don't remember if before _ also has to be \ :)
 

serpent_driver

Well-Known Member
#8
Try both, but in case you don't know it.
  1. PHP version in console or for cron is not the same as for the frontend
  2. lsphp and LSWS is not in use in console or for cron
  3. In console or for cron everthing is controlled by control panel, so your issue has nothing to do with LiteSpeed.
 
#9
Try both, but in case you don't know it.
  1. PHP version in console or for cron is not the same as for the frontend
  2. lsphp and LSWS is not in use in console or for cron
  3. In console or for cron everthing is controlled by control panel, so your issue has nothing to do with LiteSpeed.
Like I said before - that cron is launched as a browser triggering script, it's not php-cli/console ;)
Cron based on php-cli/console will not have timeout problems ;P
 
#12
This one is ok ?
Code:
<IfModule Litespeed>
    SetEnvIf Request_URI "^\/crons\/active_trainings\.cron\.php" noabort noconntimeout
    </IfModule>
Or this ?


Code:
<IfModule Litespeed>
    SetEnvIf Request_URI "^\/crons\/active\_trainings\.cron\.php" noabort noconntimeout
</IfModule>
Because I don't remember if before _ also has to be \ :)
Both not working... again terminated after 60 minutes.... :///
 
#15
I found option "Connection Timeout (secs)" with 3600 value in Tuning menu in LiteSpeed admin... I changed it to 36000 and we will see if it helps... I'll let you know.
 

AndreyPopov

Well-Known Member
#16
I don't have it in "WebAdmin > Configuration > Server(or Vhost) > External App > your external application > Environments"... I guess because of DirectAdmin :p
DirectDamin is only one of possiblities

https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:php#config

Control panel environment
If you use any control panel such as cPanel, Plesk or DirectAdmin , there is no extra configuration required since LSWS installation script will configure everything for you and you should be able to run PHP out of the box after installation. LSWS will use the same PHP version as Apache set on your control panel automatically.
https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:php:configuring-lsws-for-php
If you like the command line, you can set or modify the external application from LSWS configuration file:

vi /usr/local/lsws/conf/httpd_config.xml
 
Top