In this article , we will learn to know which version of php you are using on different platforms .
If you are on windows , linux , macOS or any other Operating System , you need to know in which version of php you are working on .
If you are implementing new features day to day , installing a new php-based app or trying to locate a new bug on your website , it is very important to know which version of php your web server is running .
In this tutorial you will learn which version of php you are using on different platforms .
Prerequisites
- PHP Installed
- Write access to file system
- Access to command line
Check Which PHP Version is Installed in XAMPP , LAMP , WAMP , MAMP
The simplest method of checking php version of XAMPP , LAMPP , WAMP is by executing a simple PHP file containing below code .
<?php echo phpversion(); ?>
Create a file using any code editor and write the above code in it , move this file in your htdocs directory of XAMPP/MAMP/LAMP/WAMP .
Then open a new tab in your browser and locate the full address of that file in address bar . You will find which php version your web server is using .

Check Which Version of PHP is Installed in Windows , linux and macOS
Now if you are working on a command line application of PHP or want to check which php version is installed in your operating system before developing any app .
You can use below command to check which php version is installed in your operating system .
php -v
If you are a windows user all you need to do is
- Open cmd by pressing win+R then a prompt will open asking for input
- Type cmd and press Enter .
- In command prompt Type the above command and press Enter , output will showing php version installed in your OS .
Similarly type the same command to check version of php in linux or macOS .
Check Which Version of PHP is Running on Your Website
To check which php version is running on your website you need to follow these 3 simple steps .
Step 1 : Create a file
Create a file named as phpinfo.php and type <?php echo phpversion(); ?>
in it .
Step 2 : Upload the file
Upload the created file in root directory of your web server .
Step 3 : Execute the file
Open up a browser and locate the uploaded file in your website . Output will showing your website php version .

Check in WordPress Which PHP Version is Running
To check which php version is running on wordpress
- Login to your wordpress Account
- Go to Tools -> Site Health -> Info -> Server
- Locate PHP Version section

That’s all for this article . If you find it interesting
Follow me on Linkedin : Anand Raj
Join Our Telegram community over here
Learn Firebase Chat application Development with Javascript and Jquery here
Prev Article : Learn How to Publish npm Packages