Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:php_503_error [2015/02/27 16:07]
Jackson Zhang [3. Enable Core Dump (or just turn off opcode caching)]
litespeed_wiki:php_503_error [2015/07/28 13:11]
Michael Alegre removed
Line 157: Line 157:
   - Comment out the ''​extension_dir''​ line to let PHP pick a default.   - Comment out the ''​extension_dir''​ line to let PHP pick a default.
  
 +===== 7. lsphp process is killed unexpectedly =====
 +
 +when php script is executing, if the process is killed by admin or a process monitoring daemon, it'll simply result 503 error.
 +
 +An Example:
 +
 +A WHM/cPanel server, installed a plugin "​ConfigServer Security & Firewall"​(i.e.,​CSF / LFD), it killed lsphp5 process from time to time and result 503 error.
 +
 +/​etc/​csf/​csf.conf :
 +  # This User Process Tracking option sends an alert if any cPanel user process
 +  # exceeds the time usage set (seconds). To ignore specific processes or users
 +  # use csf.pignore
 +  #
 +  # Set to 0 to disable this feature
 +  PT_USERTIME = "​1800"​
 +  ​
 +so if lsphp5 process has run 1800 seconds(30 minutes), it might be caught by csf and killed. in php suExec Daemon mode or ProcessGroup mode, it's normal that the parent lsphp5 process keep running over 30 minutes. when csf/lfd kill lsphp5 process, it'll leave logs in /​var/​log/​lfd.log,​ like
 +
 +  Jun 19 16:29:16 evo lfd[18304]: *User Processing* PID:18264 Kill:1 User:xxxxx VM:538(MB) EXE:/​usr/​local/​lsws/​fcgi-bin/​lsphp-5.4.42 CMD:lsphp5
 +
 +the time stamp match 503 error in /​usr/​local/​apache/​logs/​error_log:​
 +
 +  2015-06-19 16:​29:​16.370 [NOTICE] [173.245.50.197:​61317-0#​APVH_pingje.org] oops! 503 Service Unavailable
 +
 +the fix:
 +
 +add
 +  pexe:/​usr/​local/​lsws/​fcgi-bin/​lsphp.*
 +to end of /​etc/​csf/​csf.pignore , then restart csf / lfd
 +  # csf -r
 +
 +or in WHM,
 +  Home » Plugins » ConfigServer Security & Firewall
 +  lfd - Login Failure Daemon
 +  "​csf.pignore,​ Process Tracking"​ Edit "lfd ignore file"
 +  append following line
 +  pexe:/​usr/​local/​lsws/​fcgi-bin/​lsphp.*
 +  "​Restart Lfd"
 +
 +===== 8. lsphp process hit memory limit =====
 +
 +when define a lsphp external application,​ there are 2 litespeed specific settings:
 +
 +  * Memory Soft Limit (bytes) (https://​www.litespeedtech.com/​docs/​webserver/​config/​extapps#​memSoftLimit)
 +  * Memory Hard Limit (bytes) (https://​www.litespeedtech.com/​docs/​webserver/​config/​extapps#​memHardLimit)
 +
 +As stated in the document: "The main purpose of this limit is to prevent excessive memory usage because of software bugs or intentional attacks, not to impose a limit on normal usage. Make sure to leave enough head room, otherwise your application may fail and 503 error may be returned."​
 +
 +so for example in a shared hosting server, with memory soft/hard limit set, if an php script in an account consumes too many memory, it'll fail(return 503 error) and other accounts are not affected. the ideal solution is to optimize the php script to consume less memory. A quick and temporary workaround is to raise the soft/hard limit to a big value(for example 8G), to see if the 503 error will be gone. here's a use case : https://​www.litespeedtech.com/​support/​forum/​threads/​solved-xenforo-rebuild-attachment-thumbnails-503.12403/​
 ====== Real World Examples ====== ====== Real World Examples ======