Software Versions: Difference between revisions

From Psygen Wiki
Jump to navigation Jump to search
Line 22: Line 22:
== PHP ==
== PHP ==


<code>php -v</code>
<code>php -v</code> - php version


<code>php -m</code> - shows loaded php modules
<code>php -i</code> - shows a BUNCH of php info ... may want to grep...


== Check-all One-liner ==
== Check-all One-liner ==

Revision as of 03:59, 23 April 2017

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


References

  1. Script by Ryan Oberlin