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,092

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

  • Git basics: The simple commands to begin with
  • How To Install Nginx, PHP on Ubuntu 22.04
  • ES6 classes
  • Here are 10 platforms where you can find your next remote job as a developer.
  • How to Delete and Remove Files on Ubuntu Linux Terminal
  • How to clear your cache in npm

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

HTML Tutorial
How to Delete and Remove Files on Ubuntu Linux Terminal
How To Install Nginx, PHP on Ubuntu 22.04
How to make the scrollbar visible in mobile browsers with CSS?
How to check the PHP version

Quick Navigation

  • About
  • Contact
  • Privacy Policy

© Teach Developer 2021. All rights reserved