linux,apache,mysql,php常用查看版本信息的方法

1. 查看linux的内核版本,系统信息,常用的有三种办法:

uname -a; cat /proc/version;

-bash-4.2$ uname -a
Linux apphost 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
-bash-4.2$ cat /proc/version
Linux version 3.10.0-514.26.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Jul 4 15:04:05 UTC 2017

2. 查看apache的版本信息,如果是通过yum,或者是rpm安装的,可以使用rpm -qa |gerp httpd 来查看;

-bash-4.2$ rpm -qa | grep httpd
httpd-2.4.6-80.el7.centos.x86_64
httpd-tools-2.4.6-80.el7.centos.x86_64

还可以通过httpd -v来查询;

-bash-4.2$ httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Apr 20 2018 18:10:38

3.查看php的版本信息,如果是通过yum,或者是rpm包安装的,可以使用rpm -qa |grep php来查看;

-bash-4.2$ rpm -qa | grep php
php-common-5.4.16-42.el7.x86_64
php-5.4.16-42.el7.x86_64
php-cli-5.4.16-42.el7.x86_64
php-gd-5.4.16-42.el7.x86_64
php-devel-5.4.16-42.el7.x86_64
php-pdo-5.4.16-42.el7.x86_64
php-mbstring-5.4.16-42.el7.x86_64
php-process-5.4.16-42.el7.x86_64
php-mcrypt-5.4.16-7.el7.x86_64
php-mysqlnd-5.4.16-42.el7.x86_64

同样,也可以使用php -v来查看php的版本信息;

-bash-4.2$ php -v
PHP Warning:  Module 'pcntl' already loaded in Unknown on line 0
PHP 5.4.16 (cli) (built: Nov  6 2016 00:29:02) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

4. 查看mysql的版本信息,如果是通过yum安装的,或者是rpm包安装的,可以使用rpm -qa |grep mysql 来查看;

-bash-4.2$ rpm -qa | grep mysql
mysql-community-server-5.7.19-1.el7.x86_64
mysql-connector-python-2.1.7-1.el7.x86_64
mysql-utilities-1.6.5-1.el7.noarch
mysql-community-client-5.7.19-1.el7.x86_64
mysql-community-libs-compat-5.7.19-1.el7.x86_64
mysql-community-common-5.7.19-1.el7.x86_64
mysql-community-libs-5.7.19-1.el7.x86_64
mysql57-community-release-el7-10.noarch
php-mysqlnd-5.4.16-42.el7.x86_64

也可以使用mysql -v

-bash-4.2$ mysql -V
mysql  Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using  EditLine wrapper

也可以进入mysql,然后通过命令status来查看;

-bash-4.2$ mysql -utangbing -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4764
Server version: 5.7.19 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

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

Connection id:          4764
Current database:       
Current user:           tangbing@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.7.19 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:                 2 days 6 hours 14 min 34 sec

Threads: 4  Questions: 279544  Slow queries: 0  Opens: 13870  Flush tables: 1  Open tables: 1871  Queries per second avg: 1.431
--------------

 

posted @ 2018-07-15 21:59  千秋伟业  阅读(1343)  评论(0编辑  收藏  举报