Try running the following at the command line.

To just get the version information:

php -v

Or to get a lot of info:

php -i

It should give you all information you need about the php install.

Answer from Paxxi on Stack Exchange
🌐
nixCraft
cyberciti.biz › nixcraft › howto › php › how to check php version
How to Check and Print PHP Version on Linux / Unix - nixCraft
April 9, 2024 - The most reliable way to print PHP version from the Linux and Unix command line is to type the following command: $ php --version Outputs from my SUSE Enterprise/OpenSUSE Linux server:
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to check php version
How to Check PHP Version | phoenixNAP KB
December 9, 2025 - ... The command outputs the PHP version number, build date, and copyright information. Note: If there is more than one PHP version installed on the server, the php -v command shows the default command-line interface (CLI) version.
🌐
Wikihow
wikihow.com › computers and electronics › software › web programming › how to check php version: 3 ways on windows, mac, & linux
How to Check PHP Version: 3 Ways on Windows, Mac, & Linux
December 3, 2025 - If you have command line access on the server on which PHP is installed, you can check the PHP version using the command php -v. If the server is remote, you may need to SSH in. First, open your command line interface: Windows Command Prompt: ...
🌐
Benjamin Crozat
benjamincrozat.com › home › blog › check php version: command line and browser methods
Check PHP version: command line and browser methods
September 2, 2023 - To check your PHP version, run php -v in your terminal. The first line shows your current version immediately. If you cannot use the terminal, phpinfo(), phpversion(), and Laravel’s php artisan about command are the next easiest options.
🌐
The Geek Diary
thegeekdiary.com › how-to-check-the-php-version-on-linux
How to check the PHP version on Linux – The Geek Diary
You can get the version of PHP installed using the phpinfo() function or using the commands "php --version" or "php -v". You can also check for the package versions installed on the system to get the PHP version.
🌐
Simplified
simplified.guide › php › check-version
How to check PHP version
Run php -i from the command line. $ php -i | grep "PHP Version" PHP Version => 7.4.3 PHP Version => 7.4.3
Top answer
1 of 9
108

I use the following command to view installed PHP versions in Ubuntu:

sudo update-alternatives --list php

Second way go to php directory where all PHP version configuration file stored:

cd /etc/php 
dir 

Output:

 > 5.6  7.0  7.1
2 of 9
40

Since you have a Linux environment, you can run this on your console:

locate bin/php

And then for anything that looks like a PHP binary, get the version. The output for me for the above is:

/home/xx/Development/Personal/Project1/webapp/bin/phpunit
/home/xx/Development/Personal/Project1/webapp-backup/vendor/bin/phpunit
/home/xx/Development/Personal/Project2/app/vendor/bin/phpunit
/home/xx/php-threaded/bin/php
/home/xx/php-threaded/bin/php-cgi
/home/xx/php-threaded/bin/php-config
/home/xx/php-threaded/bin/phpize
/usr/bin/php
/usr/bin/php5
/usr/local/bin/php-cgi
/usr/local/bin/php-config
/usr/local/bin/php53
/usr/local/bin/phpize
/usr/sbin/php5dismod
/usr/sbin/php5enmod
/usr/sbin/php5query

Out of those, there are a few that look like PHP binaries. So let's get the version for each:

/home/xx/php-threaded/bin/php -v
/usr/bin/php -v
/usr/bin/php5 -v
/usr/local/bin/php53 -v

That will give you the versions of PHP you have installed.

I wouldn't bother deleting an old version, it might remove files that will stop things working. You can just configure the console version, or the Apache version, to use the version you want.


In answer to your supplementary question: it seems that you've followed the instructions here to add an unofficial repo to your version of Ubuntu, since the standard repo does not support 5.5.

We discovered together that the way to get it working was first to upgrade Apache from 2.2 to 2.4:

sudo apt-get upgrade apache2

It should be noted that this can cause some vhost repair to be required, as some Apache directives changed in this version. Once you have done that, you can get the new version of mod_php:

sudo apt-get install libapache2-mod-php5
Find elsewhere
🌐
Gcore
gcore.com › home › developers › how to check the php version
How to check your PHP version via CLI or PHP File | Gcore
April 8, 2025 - A Detailed Guide Explaining How to Verify the PHP Version on Your Server, Utilizing Either the Command Line Interface or a PHP File.
🌐
Reddit
reddit.com › r/phphelp › how to check php version?
r/PHPhelp on Reddit: How to check PHP version?
November 4, 2023 -

hi, I'm new to PHP.

I want to change display_errors to On for debugging, but see many PHP versions installed.

I thought going to http://localhost/first/index.php?language=English&page=phpinfo would give me the version , but it just renders the regular index page.

Ty.

🌐
TecAdmin
tecadmin.net › check-php-version
How to Check PHP Version (Apache, Nginx and CLI) – TecAdmin
April 26, 2025 - To determine the PHP version that is currently set as default for command line operations, run the subsequent command in the terminal: ... Output PHP 7.4.8 (cli) (built: Jul 13 2020 16:45:28) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies
🌐
Codecourse
codecourse.com › articles › how-to-check-your-php-version-3-ways
How to Check Your PHP Version (3 Ways)
The terminal is the easiest way to check which PHP version you're running. This requires no code to be written, just a simple command. ... You'll get an output similar to the following. You'll notice that this gives the PHP version with (cli) appended. Crucially, this means the version of the CLI (command line ...
🌐
Beyond GTA Inc.
beyondgta.com › post › the-impact-of-php-version-and-how-to-check-it
The Impact of PHP Version and How to Check it
May 21, 2024 - # Example command to navigate to the PHP installation location cd /usr/local/bin · After this, running php -v will correctly display the PHP version.
🌐
LinuxConfig
linuxconfig.org › home › how to check php version on ubuntu
How to check PHP version on Ubuntu
September 22, 2020 - $ php -version PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies · What if we want a little more in depth information? You can start a PHP interactive shell (again, from the command line) and use the phpinfo function.
🌐
eUKhost
eukhost.com › home › how to check your php version via ssh
How to check your PHP version via SSH - eukhost
July 3, 2024 - This article explains how to check your PHP version via SSH. It is essential for ensuring compatibility with your applications and for security purposes. ... Use an SSH client like PuTTY (for Windows) or Terminal (for macOS/Linux). ... Substitute ‘username’ with your actual server username and your-server-ip with your server’s IP address. ... When prompted, enter your password. You won’t see the password as you type for security reasons. ... This command will output the PHP version installed on your server.
🌐
Linux TLDR
linuxtldr.com › home › how to check php version in linux (via 4 methods)
How to Check PHP Version in Linux (via 4 Methods)
February 20, 2025 - $ /path/to/php phpversion.php | grep "PHP Version" ... This method would work for all Linux distributions, as well as Windows and macOS. If you’ve relocated the PHP directory and can’t locate it, neither of the previous methods will work.
🌐
Laravel Daily
laraveldaily.com › post › how-to-quickly-check-php-version-cli-nginx-laravel
How to Quickly Check PHP Version: CLI, NginX, Laravel
Let's see how to check these versions. ... Using the grep command, you can quickly identify each site's PHP version. ... From the socket in the output, we can see that they all run on PHP 8.1. /etc/nginx/sites-enabled/web1.test: fastcgi_pass ...
🌐
Envato Tuts+
code.tutsplus.com › home › php › php scripts
How to Check the PHP Version | Envato Tuts+
June 30, 2020 - If you don’t want to set the PATH environment variable, you could also go to the directory where you’ve installed PHP and run the php -v command from there. So that was a brief introduction to the CLI option to check the PHP version.
🌐
How To Check Version
howtocheckversion.com › check-php-version-running
How to check what PHP version I am running – How To Check Version
September 28, 2023 - If you are a Linux command line lover you can run this and see what version of PHP you are running: [crayon-6996874d3872a398186826/] or you can alternatively run this to get strictly the version nu…
🌐
Linuxize
linuxize.com › home › php › how to check the php version
How to Check the PHP Version | Linuxize
January 20, 2020 - To get the server version, invoke the php binary using the --version or -v option: ... The command will output information about the PHP version and exit.