When working with PHP, it is essential to know the version of the PHP interpreter installed on your system. This is especially true when using XAMPP, a popular platform for developing PHP applications on Windows, macOS, and Linux systems. In this blog post, we will show you how to find the PHP version installed in your XAMPP server.
Finding PHP Version Using XAMPP Control Panel
You can find the PHP version installed in XAMPP in the XAMPP Control Panel. Here are the steps to do so:
- Launch the XAMPP Control Panel.
- Under the ‘Modules’ section, look for the ‘Apache’ module.
- In the ‘Apache’ module row, click on the ‘Admin’ button.
- A new browser window will open, displaying the XAMPP Dashboard.
- Under the ‘General’ section, you will find the PHP version listed as “PHP Version x.y.z” (where x.y.z is the version number).
For example, if you see “PHP Version 7.4.16” in the XAMPP Dashboard, it means that your XAMPP server is running PHP 7.4.16.
Finding PHP Version Using phpinfo()
You can also find the PHP version installed in XAMPP by using the phpinfo() function. To do this, follow these steps:
- Create a new PHP file (e.g., “phpinfo.php”) in your XAMPP’s htdocs folder (usually located at C:\xampp\htdocs on Windows or /Applications/XAMPP/xamppfiles/htdocs on macOS).
- Open the newly created PHP file in your favorite text editor.
- Add the following code to the file:
- Save and close the file.
- Start Apache server from the XAMPP Control Panel if not already running.
- Open your web browser and navigate to http://localhost/phpinfo.php.
- The PHP information page will be displayed. Look for the “PHP Version” row in the first table. The version number will be displayed as “x.y.z” (where x.y.z is the version number).
For example, if you see “PHP Version 7.4.16” in the PHP information page, it means that your XAMPP server is running PHP 7.4.16.
By following the steps mentioned above, you can quickly find the PHP version installed in your XAMPP server using either the XAMPP Control Panel or the phpinfo() function. Knowing the PHP version is essential to ensure compatibility with the PHP scripts and frameworks you use in your projects.