1. 程式人生 > >Cent OS檢視Apache,Mysql和PHP版本資訊

Cent OS檢視Apache,Mysql和PHP版本資訊

1.檢視Linux系統資訊

[[email protected] ~]# uname -a
Linux iZbp13nush4c657vxdn89lZ 2.6.32-642.6.2.el6.x86_64 #1 SMP Wed Oct 26 06:52:09 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] ~]# more /etc/issue
CentOS release 6.8 (Final)
Kernel \r on an \m
[[email protected] ~]# cat /proc/version
Linux version 2.6.32-642.6.2.el6.x86_64 (

[email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) ) #1 SMP Wed Oct 26 06:52:09 UTC 2016

2.檢視Apache版本資訊

如果是通過yum,或者是rpm安裝的,可以使用rpm -qa |gerp httpd 來檢視;

[[email protected] ~]# rpm -qa |grep httpd
httpd-tools-2.2.15-56.el6.centos.3.x86_64
httpd-2.2.15-56.el6.centos.3.x86_64
[[email protected]

~]# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built:   Jan 12 2017 17:09:39

3.檢視php的版本資訊

如果是通過yum,或者是rpm包安裝的,可以使用rpm -qa |grep php來檢視;

也可以通過php -v來檢視php版本資訊

[[email protected] ~]# php -v
PHP 5.6.30 (cli) (built: Jan 19 2017 08:09:42)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans

一般情況下,大多是通過安裝lamp後,使用phpinfo的測試頁來檢視安裝的php的資訊;

4. 檢視mysql的版本資訊

如果是通過yum安裝的,或者是rpm包安裝的,可以使用rpm -qa |grep mysql 來檢視

[[email protected] ~]# rpm -qa |grep mysql
php-mysqlnd-5.6.30-1.el6.remi.x86_64
mysql-community-common-5.7.17-1.el6.x86_64
mysql-community-libs-5.7.17-1.el6.x86_64
mysql-community-client-5.7.17-1.el6.x86_64
php56-php-mysqlnd-5.6.30-1.el6.remi.x86_64
mysql57-community-release-el6-9.noarch
mysql-community-server-5.7.17-1.el6.x86_64
[[email protected] mysql]#

也可以使用mysql -v 或者是--help|grep Distrib來檢視

[[email protected] ~]# mysql -V
mysql  Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using  EditLine wrapper
[[email protected] ~]# mysql --help |grep Distrib
mysql  Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using  EditLine wrapper

可以進入mysql,然後通過命令select version()或者status來檢視

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.17    |
+-----------+
1 row in set (0.00 sec)

mysql> status;
--------------
mysql  Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using  EditLine wrapper

Connection id:          81
Current database:
Current user:           [email protected]
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.7.17 MySQL Community Server (GPL)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql/mysql.sock
Uptime:                 1 hour 10 min 32 sec

Threads: 1  Questions: 667  Slow queries: 0  Opens: 333  Flush tables: 1  Open tables: 199  Queries per second avg: 0.157
--------------

mysql>