Astrology & Spirituality‌

How to Verify Your PHP Version Using the Command Prompt (CMD)

How to Check PHP Version in CMD

Checking the PHP version on your system is an essential step when troubleshooting or configuring PHP applications. Whether you are a developer or a system administrator, understanding how to check the PHP version in the Command Prompt (CMD) can save you time and effort. In this article, we will guide you through the process of checking the PHP version in CMD on both Windows and Linux operating systems.

Checking PHP Version in CMD on Windows

On Windows, you can easily check the PHP version by opening the Command Prompt and typing the following command:

“`
php -v
“`

Press Enter, and the Command Prompt will display the PHP version installed on your system, along with additional information such as the configuration details. If you encounter any issues while running this command, make sure that PHP is correctly installed and added to your system’s PATH environment variable.

Checking PHP Version in CMD on Linux

On Linux, the process is quite similar. Open the Command Prompt (also known as Terminal) and type the following command:

“`
php -v
“`

Press Enter, and the Terminal will display the PHP version installed on your system. If you do not have PHP installed, you will see an error message indicating that the command is not found.

Using PHPInfo() to Check PHP Version and Configuration

Another method to check the PHP version and configuration details is by using the PHPInfo() function. This function generates a report containing information about the PHP configuration, installed extensions, and more. To use this method, create a new PHP file with the following content:

“`php

“`

Save the file with a `.php` extension, such as `info.php`. Now, navigate to the file’s location in the Command Prompt or Terminal and run the following command:

“`
php info.php
“`

Press Enter, and the web browser will open, displaying the PHP version and configuration details.

Conclusion

In conclusion, checking the PHP version in CMD is a straightforward process that can be done on both Windows and Linux operating systems. By using the `php -v` command or the PHPInfo() function, you can quickly determine the PHP version and configuration details, which can be helpful for troubleshooting and configuration purposes.

Related Articles

Back to top button