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
703

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 Delete Files in Ubuntu Command Line
  • How to Create Live Search in HTML table with jQuery
  • How to change password in the CodeIgniter framework
  • How to Delete and Remove Files on Ubuntu Linux Terminal
  • How to style an HTML radio button to look like a checkbox with CSS?
  • How to use events listeners and Event Subscriber in Symfony

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

How to split a string into an array with Twig
How to Delete Files in Ubuntu Command Line
How to make the scrollbar visible in mobile browsers with CSS?
How to style an HTML radio button to look like a checkbox with CSS?
How to increase browser zoom level on page load with CSS?

Quick Navigation

  • About
  • Contact
  • Privacy Policy

© Teach Developer 2021. All rights reserved