How to check version of php

Categories: PHP

How to Check the Version of PHP You're Running

 

A Simple Command to Check Your PHP Information

 

If you can't get something to work and think it might be because you have the wrong version of PHP, there's a really simple way to check the current version. 

Different versions of PHP may have different default settings, and in the case of newer versions, might have new functions.

If a PHP tutorial is giving instructions for a particular version of PHP, it's important to understand how to check the version you have installed.

 

How to Check the PHP Version

Running a simple PHP file will not only tell you your PHP version but an abundance of information about all your PHP settings. Just put this single line of PHP code in a blank text file and open it on the server:

<?php phpinfo() ?>

Below is how to check the locally installed version of PHP. You can run this in Command Prompt in Windows or Terminal for Linux/macOS.

php -v

Here's an example output:

 

Is the PHP Version Not Showing in Windows?

Given that you actually are running PHP on your web server, the most common reason for the version of PHP not showing up is if the path to PHP is not set up with Windows.

 

You might see the error like this if the correct environment variable isn't configured:

 

‘php.exe’ is not recognized as an internal or external command, operable program or batch file.

 

 

In a Command Prompt, type the following command, where the path after "C:" is the path to PHP (yours may be different):

 

set PATH=%PATH%;C:\php\php.exe

Top articles
How to check version of php Published at:- Definition and Type of Python Comment Published at:- Pass by reference vs value Published at:- Python - Network Programming Published at:- PHP Installation on Mac OS X with Apache Published at:- PHP Installation on Windows XP 2000 and XP with IIS Published at:- PHP Installation on Windows XP 2000 & XP with Apache Published at:- PHP MCQ Quiz Question with Answer Published at:- PHP MCQ Quiz Question with Answer (set 2) Published at:- 5 Laravel Development Tools Developers Must Use Published at:- PHP and its use Published at:-
R4Rin Team
The content on R4Rin.com website is created by expert teams.