Find Out PHP Version installed On Unix / Linux Server

by on January 21, 2012 · 1 comment· LAST UPDATED January 21, 2013

in , , ,

How do I find out php version under Linux operating systems? How do I find out php version under Unix like systems? How to find out what version of PHP is installed on my server?

To find out php version installed on the server type the following commands:
Tutorial details
DifficultyEasy (rss)
Root privilegesNo
RequirementsPHP
Estimated completion timeN/A

$ php --version

OR

$ php-cgi --version

OR

$ php5-cgi --version

OR

$ php5 --version
Sample output

PHP 5.3.3 (cgi-fcgi) (built: Jun 25 2012 04:38:39)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

I do not have SSH based access to my hosting server

If you can not login to your server using ssh commmand. Create a php script as follows (myversion.php):

 
<?php
// program to tell php version using ftp client
phpinfo();
?>
 

Upload the above file using ftp client and type the url:
http://your-domain-name-here/myversion.php
OR
http://your-domain-name-here/path/to/myversion.php
Sample outputs:

Fig.01: What version of PHP am I running on my Unix / Linux / Windows server?

Fig.01: What version of PHP am I running on my Unix / Linux / Windows server?

Using package manager

Type the following command on RHEL / Red Hat / CentOS / Fedora Linux based system to find out php version:
$ yum info php
Sample outputs:

Loaded plugins: auto-update-debuginfo, protectbase, rhnplugin
0 packages excluded due to repository protections
Installed Packages
Name        : php
Arch        : x86_64
Version     : 5.3.3
Release     : 14.el6_3
Size        : 3.5 M
Repo        : installed
From repo   : rhel-x86_64-server-6
Summary     : PHP scripting language for creating dynamic web sites
URL         : http://www.php.net/
License     : PHP
Description : PHP is an HTML-embedded scripting language. PHP attempts to make it
            : easy for developers to write dynamically generated webpages. PHP also
            : offers built-in database integration for several commercial and
            : non-commercial database management systems, so writing a
            : database-enabled webpage with PHP is fairly simple. The most common
            : use of PHP coding is probably as a replacement for CGI scripts.
            :
            : The php package contains the module which adds support for the PHP
            : language to Apache HTTP Server.

OR just list packages:
$ rpm -qa | grep php
If you are using Debian / Ubuntu Linux based system, type the following command to find out php version:
$ dpkg --list | grep php
Sample outputs:

ii  libapache2-mod-php5                      5.3.3-7+squeeze14                  server-side, HTML-embedded scripting language (Apache 2 module)
ii  php5                                     5.3.3-7+squeeze14                  server-side, HTML-embedded scripting language (metapackage)
ii  php5-cgi                                 5.3.3-7+squeeze14                  server-side, HTML-embedded scripting language (CGI binary)
ii  php5-cli                                 5.3.3-7+squeeze14                  command-line interpreter for the php5 scripting language
ii  php5-common                              5.3.3-7+squeeze14                  Common files for packages built from the php5 source
ii  php5-gd                                  5.3.3-7+squeeze14                  GD module for php5
ii  php5-mysql                               5.3.3-7+squeeze14                  MySQL module for php5
ii  php5-suhosin                             0.9.32.1-1                         advanced protection module for php5
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 1 comment… read it below or add one }

1 LARIS December 18, 2013 at 3:27 pm

Hello,

Firstly, I’d like to thank you for this post.
Secondly, I’ll be thankful if you can tell me how can I know which Ajax version (or librairy) my php server is using ?

For info, I’m using ClearOS with PHP 5.1.6 and I’m not able to use Ajax fonctions on this server, tried on xampp server on windows and it’s working fine.

Many Thanks for your help.

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , ,

Previous Faq:

Next Faq: