How to check You PHP Version

Overview of PHP and Its Importance

New PHP versions are typically delayed to be implemented by hosting companies on their systems. As a result, how to Check Your PHP Version? there are numerous PHP versions available online at any given time.

Knowing which PHP version your web server is using is crucial if you’re adding new features, setting up a new PHP-based application, or looking for bugs on your website.

You will discover how to verify How To Check Your PHP Version? in this lesson in our Blog by executing PHP code on your server or by using the command line.

How to Check Your PHP Version: Methods to Determine Your PHP Version

PHP (Hypertext Preprocessor) is a widely used open-source scripting language that is especially suited for web development and can be embedded into HTML. It is a server-side language, which means that it runs on the server and generates dynamic content that is sent to the client’s web browser.

  1. PHP installed
  2. Write access to the server’s file system
  3. Access to the command line

Run PHP Code to Verify PHP Version: Executing PHP Code

Executing a PHP file containing the following code will reveal the PHP version that is currently in use on your website.

  • <?php
  • PHP version (); echo "PHP version:"

Upload the file to your website’s document root directory after creating it in a text editor like gedit or Notepad.

Then launch a web browser and enter the complete file address in the address box. To upload a file named phpinfo. Php to the root directory of example.com, for instance, go to:

  • http://www.example.com/phpinfo.php

The code above just displays the PHP version, as shown in the output below:

How to Check PHP Version?

Upload a file containing the phpinfo () function if you need more information about your PHP configuration, such as system information, the build date, server API, configuration file information, etc.

  • <? php
  • phpinfo ();

This file displays the PHP version in the top-left corner of the browser window, followed by configuration information

Flash Sale Alert! Up to 90% Off on All Hosting Plans – Act Fast!

Reliable Hosting, Affordable Prices – Sign Up Today and Enjoy a Free Domain Name!

Upload a file with the following code to get a list of all the loaded PHP extensions and their versions:

  • <?php
  • get loaded extensions () as I => $ext, for each
  • {
  • echo "$ext". "=> ". phpversion($ext). "br/>";
  • }

Each extension is displayed separately in the output together with the PHP core version

Related article: How to Update PHP in WordPress

Command Line Instructions for Different Operating Systems to Check the Version of PHP

Use the command line to look up the installed PHP version if you have access to SSH into the remote server. The local installation of PHP can be verified using this method as well.

1: Enter the PHP command.

  • php -v

2: Linux, macOS, Windows, and other supported operating systems all support the php -v command. The output includes copyright information as well as the PHP version number and build date.

Correct “PHP is not Recognized” Mistake on Windows: Troubleshooting

How to Check PHP Version? The PHP -v command on Windows occasionally returns the message “php is not recognized” because the system does not recognize the PHP path.

Set the PATH environment variable first to fix this issue.

1: Enter the path to your PHP installation in place of [location] in the command below.

  • establish PATH=%PATH%;[location]

2: The PHP version installed on your Windows machine is now displayed when you use php -v.

Conclusion

The purpose of this post was to describe how to verify How to Check PHP Version. installed on your server or local computer. The command-line interface and running PHP code are two of the techniques discussed in this lesson.

For reliable and scalable hosting solutions, make sure to visit ARZ Host.

Latest Posts:

Table of Content