≡ Menu

How to find out my PHP and Perl versions?

Question – I am using CentOS Linux as my web hosting server. How do I find out the versions of the Perl and PHP interpreters on my machine?

Perl and PHP both are interpreted languages. Perl stands for Practical Extraction and report language. PHP stands for PHP Hypertext Processor. The acronym of PHP is called a recursive acronym. Both languages have their merits. Perl is very useful for writing short prototype scripts which use a lot of data extraction and regular expressions. PHP is great for web applications and writing quick web applications that can be pushed to production very fast.

Perl - Practical Extraction and Report Language
PHP - PHP Hypertext Processor

How to find out the PHP version?

To find out your PHP version, type in the following command on your SSH shell prompt or your local terminal:

php -i | grep -i version

This will output the versions of a lot of things including the PHP interpreter version at the very top:

[root@server ~]# php -i | grep -i version
PHP Version => 5.3.3
BZip2 Version => 1.0.5, 10-Dec-2007
PHP Version => 5.3.3
SSL Version => NSS/
ZLib Version => 1.2.3
libSSH Version => libssh2/1.2.2
"Olson" Timezone Database Version => 0.system
EXIF Version => 1.4 $Id: exif.c 293036 2010-01-03 09:23:27Z sebastian $
Supported EXIF Version => 0220
version => 1.0.5-dev
GMP version => 4.3.1
iconv library version => 2.12
json version => 1.2.1
libXML Compiled Version => 2.7.6
libXML Loaded Version => 20706
OpenSSL Library Version => OpenSSL 1.0.0-fips 29 Mar 2010
OpenSSL Header Version => OpenSSL 1.0.0-fips 29 Mar 2010
PCRE Library Version => 7.8 2008-09-05
Phar EXT version => 2.0.1
Phar API version => 1.1.1
Version => $Revision: 300393 $
XCache Version => 3.0.3
libxml2 Version => 2.7.6
Extension Version => $Id: php_zip.c 300470 2010-06-15 18:48:33Z pajoye $
Zip version => 1.9.1
Libzip version => 0.9.0
Compiled Version => 1.2.3
Linked Version => 1.2.3

So the PHP version of PHP on my machine is 5.3.3.

Another way of finding out the PHP version is to write a script called phpinfo.php and add the following lines to it:


Upload the script to your server and visit http://www.yourdomain.com/phpinfo.php. This will show you something similar to what php -i shows.

How to find out the Perl version?

To find out the Perl interpreter version, type the following command on your SSH shell prompt:

perl -v

This will output something like the following:

[root@server ~]# perl -v

This is perl, v5.10.1 (*) built for i386-linux-thread-multi

Copyright 1987-2009, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

[root@server ~]#

So my Perl version is 5.10.1 as shown bolded in the above output.

{ 0 comments… add one }

Leave a Comment