Software Versions: Difference between revisions
Line 68: | Line 68: | ||
<pre> | <pre> | ||
alias ll="ls -lah";echo "";echo -e "\e[93m \e[1mDate and Time: \e[0m";date;echo "";echo -e "\e[93m \e[1mLoad and who is logged in: \e[0m";w;echo " ";echo -e "\e[93m \e[1mHostname: \e[0m";hostname; echo ""; echo -e "\e[93m \e[1mOperating System: \e[0m"; cat /etc/redhat-release;echo "";echo -e "\e[93m \e[1mLoadwatch: \e[0m";if [ -e /root/loadwatch ]; then echo -e "\e[32mLoadwatch found\e[0m"; else echo -e "\e[31mLoadwatch not found\e[0m"; fi;echo "";echo -e "\e[93m \e[1mcPanel Version: \e[0m";/usr/local/cpanel/cpanel -V;echo "";echo -e "\e[93m \e[1mApache Version: \e[0m";httpd -v; httpd -V | grep 'MPM';echo "";echo -e "\e[93m \e[1mMySQL Version: \e[0m";vmaria=$(mysql --version | grep -i -o mariadb); vsql=$(grep -i mysql /var/cpanel/cpanel.config | grep version | cut -d'=' -f2-);echo -e "Version: $vsql";if [ "$vmaria" = "MariaDB" ]; then echo -e "\e[95mServer is using MariaDB\e[0m"; fi;echo "";echo -e "\e[93m \e[1mPHP Info: \e[0m";vphp=$(php -v | sed -n 1p | cut -d' ' -f2- | cut -d' ' -f1|cut -c1-3|sort -b);if [ "$vphp" > "5.5" ]; then echo -e "PHP Version: \e[92m$vphp\e[0m";else echo -e "PHP Version: \e[31m$vphp\e[0m"; fi ; /usr/local/cpanel/bin/rebuild_phpconf --current ;echo "";echo -e "\e[93m \e[1mDefault Memory Limit: \e[0m";php -i |grep memory_limit | grep -v HIST;ll /opt/cpanel/ |grep -Eo ea-php[0-9]{2}|while read PHP; do echo -e "\e[93m \e[1m$PHP: \e[0m";scl enable $PHP 'php -i|grep memory_limit'; done;echo "";echo -e "\e[93m \e[1mDisk Usage: \e[0m";df -h;echo ""; echo -e "\e[93m \e[1mFree Memory: \e[0m"; free -h;echo "";cd / | |||
</pre> | </pre> | ||
Latest revision as of 00:23, 4 June 2017
cPanel
/usr/local/cpanel/cpanel -V
- Shows the current cPanel version
Easy Apache
You can check the Easy Apache Version in two ways:
1. In WHM: Software>>Easy Apache 4
- If it says "You can run Easy Apache 4 while Easy Apache 3 is running", the server is on EA3
- If it shows a bunch of options, the server is on EA4
2. Connect via SSH and run: /scripts/easyapache --version
- If it spits out a version number, that's the Easy Apache 3 version
- If it says "Easy Apache 3 cannot run while Easy Apache 4 is installed" (or something similar, EA4 is installed.
httpd -v
- Shows http version (EA3 if it says "Easy Apache v.3..." EA4 if this line is missing.)
httpd -V
- Shows the MPM along with more version info
PHP
php -v
- php version
php -m
- shows loaded php modules
php -i
- shows a BUNCH of php info ... may want to grep...
Check-all One-liner
You can run the below BASH script to get the current versions of:
- Operating system ( CentOS Linux release 7.2.1511 (Core) )
- PHP
- PHP handlers in use
- Apache
- Apache MPM
- MySQL (Also notes if Maria DB is being used)
It also shows the following information:
- system hostname
- Who's logged in (
w
) - PHP Memory Limit
- Free Memory
- Disk Usage
- Inode Usage
- CPU usage
- Memory usage
- If loadwatch is installed or not
- Current Connections
- The last five root ssh connections
- Possible loaded Apache includes files
echo ""; w; echo "";hostname; echo ""; cat /etc/redhat-release; echo "";date; echo ""&& echo "PHP Memory Limit"; php -i |grep memory_limit | grep -v HIST; echo ""; echo "Free Memory"; free -m; echo "" && echo "Disk Usage";df -h; echo ""; echo "Inodes"; df -i;echo "";echo ""; echo "PHP, Apache, MySQL Version"; vphp=$(php -v | sed -n 1p | cut -d' ' -f2- | cut -d' ' -f1|cut -c1-3|sort -b); vhttpd=$(httpd -v | grep version| cut -d '/' -f2- | cut -d' ' -f1|cut -c1-3|sort -b); vmaria=$(mysql --version | grep -i -o mariadb); vsql=$(grep -i mysql /var/cpanel/cpanel.config | grep version | cut -d'=' -f2-); if [ "$vphp" > "5.5" ]; then echo -e "PHP Version: \e[92m$vphp\e[0m";else echo -e "PHP Version: \e[31m$vphp\e[0m"; fi ; if [ "$vhttpd" > "2.2" ];then echo -e "Apache Version: \e[92m$vhttpd\e[0m"; else echo -e "Apache Version: \e[31m$vhttpd\e[0m";fi;httpd -V | grep 'MPM'; if [ "$vsql" < "5.6" ]; then echo -e "MySQL Version: \e[31m$vsql\e[0m";else echo -e "MySQL Version: \e[92m$vsql\e[0m";fi; if [ "$vmaria" = "MariaDB" ]; then echo -e "\e[95mServer is using MariaDB\e[0m"; fi; echo "" && echo "PHP Handler Info"; /usr/local/cpanel/bin/rebuild_phpconf --current ; echo "" && echo "CPU"; sar | sed -n 3p|sed -e 's/12.*AM/Time /g'; sar | tail -7; echo " "; echo "Memory Usage"; sar -r| sed -n 3p| sed -e 's/12.*AM/Time /g'; sar -r | tail -7; echo "";if [ -e /root/loadwatch ]; then echo -e "\e[32mLoadwatch found\e[0m"; else echo -e "\e[31mLoadwatch not found\e[0m"; fi; echo ""; echo "Current Connections";netstat -nt 2>/dev/null | egrep ':80|:443'| awk '{print $5}' | awk -F: 'BEGIN { OFS = ":"} {$(NF--)=""; print}' | awk '{print substr($0, 1, length($0)-1)}' | sort | uniq -c | sort -rn | head; echo ""; echo "Last Five Root SSH Connections"; last | grep root |head;echo ""; echo "Possible loaded Apache includes files"; for i in $(find /usr/local/apache/conf/includes/ -type f \( -name "post*" -o -name "pre*" \) -size +0k); do echo -e "\e[32m$i\e[0m"; done; echo ""; if [ ! -e /usr/local/lp/logs/bash_eternal_history ]; then echo -e "\e[31mBash Eternal Not Found\e[0m"; echo ""; fi
alias ll="ls -lah";echo "";echo -e "\e[93m \e[1mDate and Time: \e[0m";date;echo "";echo -e "\e[93m \e[1mLoad and who is logged in: \e[0m";w;echo " ";echo -e "\e[93m \e[1mHostname: \e[0m";hostname; echo ""; echo -e "\e[93m \e[1mOperating System: \e[0m"; cat /etc/redhat-release;echo "";echo -e "\e[93m \e[1mLoadwatch: \e[0m";if [ -e /root/loadwatch ]; then echo -e "\e[32mLoadwatch found\e[0m"; else echo -e "\e[31mLoadwatch not found\e[0m"; fi;echo "";echo -e "\e[93m \e[1mcPanel Version: \e[0m";/usr/local/cpanel/cpanel -V;echo "";echo -e "\e[93m \e[1mApache Version: \e[0m";httpd -v; httpd -V | grep 'MPM';echo "";echo -e "\e[93m \e[1mMySQL Version: \e[0m";vmaria=$(mysql --version | grep -i -o mariadb); vsql=$(grep -i mysql /var/cpanel/cpanel.config | grep version | cut -d'=' -f2-);echo -e "Version: $vsql";if [ "$vmaria" = "MariaDB" ]; then echo -e "\e[95mServer is using MariaDB\e[0m"; fi;echo "";echo -e "\e[93m \e[1mPHP Info: \e[0m";vphp=$(php -v | sed -n 1p | cut -d' ' -f2- | cut -d' ' -f1|cut -c1-3|sort -b);if [ "$vphp" > "5.5" ]; then echo -e "PHP Version: \e[92m$vphp\e[0m";else echo -e "PHP Version: \e[31m$vphp\e[0m"; fi ; /usr/local/cpanel/bin/rebuild_phpconf --current ;echo "";echo -e "\e[93m \e[1mDefault Memory Limit: \e[0m";php -i |grep memory_limit | grep -v HIST;ll /opt/cpanel/ |grep -Eo ea-php[0-9]{2}|while read PHP; do echo -e "\e[93m \e[1m$PHP: \e[0m";scl enable $PHP 'php -i|grep memory_limit'; done;echo "";echo -e "\e[93m \e[1mDisk Usage: \e[0m";df -h;echo ""; echo -e "\e[93m \e[1mFree Memory: \e[0m"; free -h;echo "";cd /
References
- Script by Ryan Oberlin