PHP Tutorials

How to Easily Check the PHP Version

PHP is a popular server-side programming language. It was introduced back in the year 1995 and created by Rasmus Lerdorf. It is an exclusively useful programming language to create an excellent web application. PHP means Hypertext Preprocessor, and a web server processes it.

There are some use cases where we require to find out which PHP versions is working on a web server.

If you plan to build a new web application and might want to update your PHP application, you may need to check the particular PHP version before getting started with the installation.

In this tutorial, i am going to share with you a few useful methods through which you can easily check which PHP version your server is working on.

PHP has been around since a very long time, since its inception it has brought us lots of version updates in the below chart you can see the PHP version history.

Check PHP Version from Command Line or Terminal

This method requires SSH access to the webserver, and you can find out the PHP version using the following command.

You can append either -v or --version with php keyword.

php --version

# or 

php -v
# output

PHP 7.3.11 (cli) (built: Feb 29 2020 02:50:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies

The above commands will give you the same output on your terminal screen, so currently, we have installed PHP 7.3.11 version.

What if you are a web server is using exquisite versions of PHP. In this case, you can run the `php` command from the terminal shell, but it will display only the default PHP CLI version. It might be the different version of PHP is being used by the web application.

Find Out PHP version with phpinfo()

The easiest method is to check the PHP version is the phpinfo() method. This function displays heaps of information about the PHP server, such as PDO, calendar, installed extensions, environment, compilation options, PHP version, web server information, and many more.

Create a file by the name of, and the place the following code in this file:




Then type the following URL on the browser’s address bar and press enter.

Then the full PHP configuration will be displayed on your browser’s screen along with the PHP version.

If you specifically want to check the PHP version and don’t want to expose the full php details, then you can use the following php method.


   echo 'Current PHP version is: ' . phpversion();



Finding out the PHP server details is not that difficult task. In this tutorial, I have shared with your the simplest methods to verify the PHP versions your server is using.

I hope you would love this tutorial and share with others as well.


I am Digamber, a full-stack developer and fitness aficionado. I created this site to bestow my coding experience with newbie programmers. I love to write on JavaScript, ECMAScript, React, Angular, Vue, Laravel.

Recent Posts

React Router DOM 6 Fetch Current URL / Pathname Tutorial

If you want to learn how to get the current route's name, component pathname or…

2 days ago

React Js Hide & Show with React Bootstrap Collapse Tutorial

React show and hide example. In this tutorial, we will show you how to step…

5 days ago

How to Integrate Tabs in React Js with React Bootstrap

Tabs are one of the best UI elements for displaying multiple contents in a single…

1 week ago

How to Build Toast Component in React Js with Bootstrap

In this tutorial, we will learn how to create a toast notification component in the…

2 weeks ago

React Js Bootstrap Modal Popup Component Tutorial

Bootstrap offers tons of custom UI solutions. On top of that, it is easy to…

2 weeks ago

React Build Counter using useReducer Hook Tutorial

React js counter using the useReducer hook example. In this post, we will learn how…

2 weeks ago