Skip to content
  • Homepage
  • HTML
  • CSS
  • Symfony
  • PHP
  • How to
  • Contact
  • Donate

Teach Developer

Articles, Guides & Tips

How to check PHP version using the command line

Home  »  How to • PHP • Tips   »   How to check PHP version using the command line
Posted on August 26, 2022September 17, 2022
1,355

If you have access to the command line or terminal, then you can check your PHP version by running the php -v or php --version command.

Here’s an example of the output:

$ php -v
PHP 8.1.5 (cli) (built: Apr 16 2022 00:03:58) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.5, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.5, Copyright (c), by Zend Technologies

You can see that the command shows the PHP version as PHP 8.1.5.

But sometimes you may not have access to the command line, or you may install PHP using a local stack like XAMPP or WAMP.

You need to use the next method when this is the case.

Check PHP version using phpinfo()

If you can’t check the PHP version from the command line, then you can call the phpinfo() function from a PHP page.

Let’s create a new file named phpinfo.php with the following code:

<?php
phpinfo();

Save the file, then open it from the browser.

How to, PHP, Tips

Post navigation

Previous Post: How do sum values from an array of key-value pairs in JavaScript?
Next Post: How to Deploy or Host your ReactJS App in cPanel

Related Posts

  • How to Use useLocation Hook in React Router DOM V6
  • How to increase browser zoom level on page load with CSS?
  • How to Deploy a React application on a cPanel
  • How to Delete Unused Database Tables in WordPress
  • ES6 classes
  • How to Delete and Remove Files on Ubuntu Linux Terminal

Categories

  • Codeigniter (3)
  • CSS (11)
  • eCommerce (1)
  • Framework (1)
  • Git (3)
  • How to (43)
  • HTML (5)
  • JavaScript (15)
  • Jquery (7)
  • Laravel (1)
  • Linux (4)
  • Magento-2 (1)
  • Node js (4)
  • Others (2)
  • PHP (11)
  • React (13)
  • Server (1)
  • SSH (3)
  • Symfony (6)
  • Tips (16)
  • Top Tutorials (10)
  • Ubuntu (3)
  • Vue (1)
  • Wordpress (7)

Latest Posts

  • What is SSH in Linux?
  • How to Delete Files in Ubuntu Command Line
  • How to Deploy a React application on a cPanel
  • How to use events listeners and Event Subscriber in Symfony
  • How to Convert PHP CSV to JSON

WEEKLY TAGS

AJAX (1) Codeigniter (1) Javascript (11) JQuery (1) PHP (16) Programming (1) React (3) Symfony (1)

Random Post

Common Mistakes with Conditionals
How to Symfony parameters and environment variables use
PHP 8.1: read-only properties
How to Search Recently Modified Files in Linux
4 Methods to Search an Array

Quick Navigation

  • About
  • Contact
  • Privacy Policy

© Teach Developer 2021. All rights reserved