Automatically Kill php-fpm or apache2 process with the High CPU in Linux

Once again I needed a solution to kill php-fpm or apache2 process with the high CPU usage and considering that I am not at the first

php-info-ini-config-path-ubuntu-server_cr

Where is the php.ini configuration and enabled PHP modules? – Ubuntu Server

PHP configuration folders is usually in /etc/php/ and the installed version, in my case is in /etc/php/7.4/ The active version can be found with the following command in