| Server IP : 198.38.94.67 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64 User : azfilmst ( 1070) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/lib64/nagios/plugins/ |
Upload File : |
#!/bin/bash
# Ref: BFENG-1101
# To verify that redis and opcache extensions are available in the specified php versions.
# Exit if isn't cPanel
if [ ! -s "/usr/local/cpanel/version" ]; then
exit
fi
_php_versions_list=("5.2" "5.3" "5.4" "5.5" "5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2" "8.3")
_php_missing_opcache=""
_php_missing_redis=""
for _php_version in "${_php_versions_list[@]}"
do
_php_extensions=$(selectorctl --interpreter=php --list-extensions --version=$_php_version | grep -wE 'opcache|redis')
if [[ $_php_extensions != *"+ opcache"* ]]; then
_php_missing_opcache+="$_php_version, "
fi
if [[ $_php_extensions != *"+ redis"* ]]; then
_php_missing_redis+="$_php_version, "
fi
done
if [[ -z $_php_missing_opcache && -z $_php_missing_redis ]]; then
echo "check_redis_opcache - All PHP versions have opcache and redis extensions enabled."
exit 0
else
if [[ -n $_php_missing_opcache && -n $_php_missing_redis ]]; then
echo "check_redis_opcache - PHP ${_php_missing_opcache%, } missing opcache extension and PHP ${_php_missing_redis%, } missing redis extension."
exit 2
elif [[ -n $_php_missing_opcache ]]; then
echo "check_redis_opcache - PHP ${_php_missing_opcache%, } missing opcache extension."
exit 2
elif [[ -n $_php_missing_redis ]]; then
echo "check_redis_opcache - PHP ${_php_missing_redis%, } missing redis extension."
exit 2
fi
fi