How to find PHP version on linux system step by step guide
In this
article we learn how to check PHP version on linux system.To check the PHP
version we execute below commands .
[root@localhost ~]#
php -v
PHP 5.3.3 (cli)
(built: Jan 10 2017 22:26:04)
Copyright (c)
1997-2010 The PHP Group
Zend Engine v2.3.0,
Copyright (c) 1998-2010 Zend Technologies
And also we execute the below
command to know the php version.
[root@localhost ~]#
php --version
PHP 5.3.3 (cli)
(built: Jan 10 2017 22:26:04)
Copyright (c)
1997-2010 The PHP Group
Zend Engine v2.3.0,
Copyright (c) 1998-2010 Zend Technologies
If the above command is not work you
should install php package in you linux system.
[root@localhost ~]#
yum install php
Loaded plugins:
ulninfo
Setting up Install
Process
Resolving Dependencies
--> Running
transaction check
---> Package php.x86_64
0:5.3.3-49.el6 will be installed
--> Processing
Dependency: php-cli(x86-64) = 5.3.3-49.el6 for package: php-5.3.3-49.el6.x86_64
--> Processing
Dependency: php-common(x86-64) = 5.3.3-49.el6 for package:
php-5.3.3-49.el6.x86_64
--> Processing
Dependency: httpd-mmn = 20051115 for package: php-5.3.3-49.el6.x86_64
--> Processing
Dependency: httpd for package: php-5.3.3-49.el6.x86_64
--> Running
transaction check
---> Package
httpd.x86_64 0:2.2.15-69.0.1.el6 will be installed
--> Processing
Dependency: httpd-tools = 2.2.15-69.0.1.el6 for package:
httpd-2.2.15-69.0.1.el6.x86_64
--> Processing
Dependency: /etc/mime.types for package: httpd-2.2.15-69.0.1.el6.x86_64
--> Processing
Dependency: apr-util-ldap for package: httpd-2.2.15-69.0.1.el6.x86_64
--> Processing
Dependency: libaprutil-1.so.0()(64bit) for package:
httpd-2.2.15-69.0.1.el6.x86_64
--> Processing
Dependency: libapr-1.so.0()(64bit) for package: httpd-2.2.15-69.0.1.el6.x86_64
---> Package
php-cli.x86_64 0:5.3.3-49.el6 will be installed
--> Processing
Dependency: libedit.so.0()(64bit) for package: php-cli-5.3.3-49.el6.x86_64
---> Package
php-common.x86_64 0:5.3.3-49.el6 will be installed
--> Running
transaction check
---> Package
apr.x86_64 0:1.3.9-5.el6_9.1 will be installed
---> Package
apr-util.x86_64 0:1.3.9-3.el6_0.1 will be installed
---> Package
apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 will be installed
---> Package
httpd-tools.x86_64 0:2.2.15-69.0.1.el6 will be installed
---> Package
libedit.x86_64 0:2.11-4.20080712cvs.1.el6 will be installed
---> Package
mailcap.noarch 0:2.1.31-2.el6 will be installed
--> Finished
Dependency Resolution
Dependencies Resolved
================================================================================
Package
Arch Version Repository Size
================================================================================
Installing:
php
x86_64 5.3.3-49.el6 public_ol6_latest 1.1 M
Installing for
dependencies:
apr x86_64 1.3.9-5.el6_9.1 public_ol6_latest 123 k
apr-util
x86_64 1.3.9-3.el6_0.1 public_ol6_latest 87 k
apr-util-ldap
x86_64 1.3.9-3.el6_0.1 public_ol6_latest 15 k
httpd
x86_64 2.2.15-69.0.1.el6 public_ol6_latest 835 k
httpd-tools
x86_64 2.2.15-69.0.1.el6 public_ol6_latest 80 k
libedit
x86_64
2.11-4.20080712cvs.1.el6
public_ol6_latest 74 k
mailcap
noarch 2.1.31-2.el6 public_ol6_latest 26 k
php-cli
x86_64 5.3.3-49.el6 public_ol6_latest 2.2 M
php-common
x86_64 5.3.3-49.el6 public_ol6_latest 529 k
Transaction Summary
================================================================================
Install 10 Package(s)
Total download size:
5.0 M
Installed size: 17 M
Is this ok [y/N]: y
Downloading Packages:
(1/10):
apr-1.3.9-5.el6_9.1.x86_64.rpm
| 123 kB 00:01
(2/10):
apr-util-1.3.9-3.el6_0.1.x86_64.rpm
| 87 kB 00:00
(3/10):
apr-util-ldap-1.3.9-3.el6_0.1.x86_64.rpm
| 15 kB 00:00
(4/10):
httpd-2.2.15-69.0.1.el6.x86_64.rpm
| 835 kB 00:04
(5/10):
httpd-tools-2.2.15-69.0.1.el6.x86_64.rpm
| 80 kB 00:00
(6/10):
libedit-2.11-4.20080712cvs.1.el6.x86_64.rpm
| 74 kB 00:00
(7/10):
mailcap-2.1.31-2.el6.noarch.rpm
| 26 kB 00:00
(8/10):
php-5.3.3-49.el6.x86_64.rpm
| 1.1 MB 00:02
(9/10):
php-cli-5.3.3-49.el6.x86_64.rpm
| 2.2 MB 00:05
(10/10):
php-common-5.3.3-49.el6.x86_64.rpm
| 529 kB 00:01
--------------------------------------------------------------------------------
Total 196
kB/s | 5.0 MB 00:26
Running
rpm_check_debug
Running Transaction
Test
Transaction Test
Succeeded
Running Transaction
Installing : apr-1.3.9-5.el6_9.1.x86_64 1/10
Installing :
apr-util-1.3.9-3.el6_0.1.x86_64 2/10
Installing :
php-common-5.3.3-49.el6.x86_64 3/10
Installing :
httpd-tools-2.2.15-69.0.1.el6.x86_64 4/10
Installing : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 5/10
Installing : mailcap-2.1.31-2.el6.noarch 6/10
Installing :
httpd-2.2.15-69.0.1.el6.x86_64 7/10
Installing : libedit-2.11-4.20080712cvs.1.el6.x86_64 8/10
Installing : php-cli-5.3.3-49.el6.x86_64 9/10
Installing : php-5.3.3-49.el6.x86_64 10/10
Verifying
: libedit-2.11-4.20080712cvs.1.el6.x86_64 1/10
Verifying
: httpd-tools-2.2.15-69.0.1.el6.x86_64 2/10
Verifying
: apr-util-ldap-1.3.9-3.el6_0.1.x86_64 3/10
Verifying
: httpd-2.2.15-69.0.1.el6.x86_64 4/10
Verifying
: php-5.3.3-49.el6.x86_64 5/10
Verifying
: apr-1.3.9-5.el6_9.1.x86_64 6/10
Verifying
: mailcap-2.1.31-2.el6.noarch 7/10
Verifying
: php-common-5.3.3-49.el6.x86_64 8/10
Verifying
: apr-util-1.3.9-3.el6_0.1.x86_64 9/10
Verifying
: php-cli-5.3.3-49.el6.x86_64
10/10
Installed:
php.x86_64 0:5.3.3-49.el6
Dependency Installed:
apr.x86_64 0:1.3.9-5.el6_9.1
apr-util.x86_64 0:1.3.9-3.el6_0.1
apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1
httpd.x86_64 0:2.2.15-69.0.1.el6
httpd-tools.x86_64 0:2.2.15-69.0.1.el6
libedit.x86_64 0:2.11-4.20080712cvs.1.el6
mailcap.noarch 0:2.1.31-2.el6
php-cli.x86_64 0:5.3.3-49.el6
php-common.x86_64 0:5.3.3-49.el6
Complete!
To check php package is installed or not
To check
the php package installed or not on your linux system you should execute the
below command.
[root@localhost ~]#
rpm -qa php*
php-5.3.3-49.el6.x86_64
php-common-5.3.3-49.el6.x86_64
php-cli-5.3.3-49.el6.x86_64
check the PHP version using web browser
To check
the PHP version and more information about PHP using web browser we should
follow the below steps.
#edit the
file /var/www/html/infophp.php and the below lines.
[root@localhost html]#
cat infophp.php
<?php
phpinfo();
?>
Type http://serverip/infophp.php and find the output in
below format
0 comments:
Post a Comment