Command in VPS - Lsphp CPU 100% in WordPress


I recently noticed that my site is experiencing some slowdowns, which led me to perform a detailed analysis on my VPS. During the investigation, I identified an issue with the LSPHP command, which is causing high CPU consumption. However, it is important to mention that this consumption only occurs when someone accesses my website or when I click on a product in my Woocommerce store. After the page loads, the CPU consumption is choppy around 02%, but if I click on another product or go to a different URL, the CPU goes up again.

I would like to request help to solve this problem. Could someone help me?

For context, I’m using Hostinger’s VPS, which has 40 SSD, 2 CPU cores and 2 TB of bandwidth. Thanks in advance for the help!

Current Operating System is CentOS 7 64-bit with CyberPanel

Welcome @EduardoSilva Happy you are here

Considering you are using PHP I believe this is a PHP sessions issue. Just run as sudo user:

$ rm -f /var/lib/lsphp/session/lsphp71/* && rm -f /var/lib/lsphp/session/lsphp72/* && rm -f /var/lib/lsphp/session/lsphp73/* 

$ rm -f /var/lib/lsphp/session/lsphp74/* && rm -f /var/lib/lsphp/session/lsphp80/* && rm -f /var/lib/lsphp/session/lsphp81/*

$ for version in $(ls /usr/local/lsws|grep lsphp); do echo ""; echo "PHP $version"; session_time=$(/usr/local/lsws/${version}/bin/php -i |grep -Ei 'session.gc_maxlifetime'| grep -Eo "[[:digit:]]+"|sort -u); find -O3 "/var/lib/lsphp/session/${version}" -ignore_readdir_race -depth -mindepth 1 -name 'sess_*' -type f -cmin +$((session_time / 60)) -delete; done

## get a cronjob to clean your php sessions

$ sh <(curl || wget -O -

Hello Joseph Godwinke,

I recently made some changes as requested, but unfortunately the problem persists when someone accesses a specific URL on my site. Do you have any idea what could be causing this problem? Thank you in advance for your help!

Command in VPS - Lsphp CPU 100% in WordPress - #2 by josephgodwinke this fixed your issue ?

The problem might persist if the server does not meet minimum requirements. Did you add the cronjob ?