1. Log into your web hosting control panel.
2. Look for the section labeled “Software and Services” or “Software/Services”.
3. Click on the “PHP Configuration” or “PHP Info” link.
4. Look for the “PHP Version” line. The number listed is the version of PHP installed on your server.
Check php version windows, linux, mac; In this tutorial, you will learn how to check php in windows, linux and mac using command line/terminal/cmd and PHP script.
PHP is a popular programming language used for web development. If you are a developer or a system administrator, it’s important to know which version of PHP is installed on your system. In this article, we’ll show you how to check the PHP version using different methods.
How to Check PHP Version
Let’s see the following methods to check the PHP version; is as follows:
- Method 1: Using the Command Line Interface
- Method 2: Using a PHP Script
- Method 3: Using a PHP Framework
Method 1: Using the Command Line Interface
The easiest way to check the PHP version on your system is by using the command line interface (CLI). Follow these steps:
- Open the command prompt (Windows) or terminal (Linux/Mac).
- Type the following command and press Enter:
- The PHP version installed on your system will be displayed in the output.Example output:
PHP 7.4.23 (cli) (built: Sep 2 2021 16:11:53) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies
Method 2: Using a PHP Script
You can also check the PHP version by creating a PHP script and running it on your web server. Follow these steps:
- Create a new file named “phpinfo.php” in the document root directory of your web server.
- Open the file in a text editor and add the following code:
- Save the file and open it in a web browser. For example, if your web server is running on localhost, you can access the file by typing “http://localhost/phpinfo.php” in the browser address bar.
- The PHP version installed on your system will be displayed on the top of the page.
- PHP Version 7.4.23
- System Windows NT LAPTOP-123 10.0 build 19042 (Windows 10) AMD64
- Build Date Sep 2 2021 16:12:01
Method 3: Using a PHP Framework
If you are using a PHP framework such as Laravel or Symfony, you can check the PHP version by running a command in the terminal. Follow these steps:
- Open the terminal and navigate to the root directory of your PHP project.
- Type the following command and press Enter:
- The PHP version used by the framework will be displayed in the output.Example output (for Laravel):
Laravel Framework 8.55.0 PHP 7.4.23 (cli) (built: Sep 2 2021 16:11:53) ( NTS ) ...
Conclusion
In this tutorial, we have shown you how to check the PHP version on your system using different methods. By knowing the PHP version, you can ensure that your web applications are compatible with the PHP version installed on your server.