Installation On Windows Systems

Here are some quick tips on how khổng lồ check the PHP. version on your computer or VPS.

Bạn đang xem: Installation on windows systems

There are several reasons why you want khổng lồ kiểm tra the version of PHPhường which is installed on your VPS. For example, you might want to lớn install PHP-based software and to kiểm tra if the software requirements match the PHPhường version installed on your hệ thống. Or you might be a developer who wants to use a feature which is only available in specific versions of PHPhường. 

There are a lot of different PHP versions, and they have sầu some noticeable differences aước ao them. With every new PHPhường version, new features are added & others are deprecated, so it’s always good to lớn know the PHP version you’re using.

There are a few different ways to kiểm tra the PHP version. Mainly, if you have sầu SSH access khổng lồ your VPS, you can use the command-line interface to lớn check it. On the other h&, if you don’t have terminal access, I’ll show you how to check the PHPhường version using the phpinfo function.

Cheông chồng the PHP. Version by Using the Terminal

In this section, we’ll discuss how you could kiểm tra the PHP version by using the command-line interface (CLI) in a terminal.

Cheông chồng the PHP.. Version on Unix, Linux, và macOS

For *nix-based systems—Linux, Unix, & macOS—it just takes a single commvà lớn check the PHPhường version. Go ahead and run the following in your terminal.

php -vYou should see an output lượt thích the following:

Cheông xã the PHP. Version on Windows

For Windows users, the same command is used lớn kiểm tra the PHP version. But you might get an error if you don"t phối the PATH environment variable first. You can do that by running the mix PATH command. Run the following commands, and make sure that you replace the PATH_TO_PHP_DIRECTORY placeholder with the directory path where you’ve installed PHP. For example, if you installed PHP in the C:softwarephp directory, you need to run set PATH=%PATH%;C:softwarephp.

Xem thêm: : Check If Checkbox Is Checked Using Jquery, Check If Checkbox Is Checked Using Jquery

mix PATH=%PATH%;PATH_TO_PHP_DIRECTORYphp -vIf you don’t want khổng lồ mix the PATH environment variable, you could also go khổng lồ the directory where you’ve sầu installed PHP. & run the php -v command from there.

cd C:softwaresphpphp -vSo that was a brief introduction lớn the CLI option to check the PHP.. version. In the next section, we’ll discuss how you could check your PHPhường version with the phpinfo function.

Check the PHP Version by Using the phpinfo Function

You can also use the phpinfo function, which prints detailed information about the PHPhường software on your server và its configuration.

This option is especially useful when you don’t have SSH access to the VPS where your site is hosted. If you want to use this option khổng lồ kiểm tra the PHP. version on the remote hệ thống, all you need is the ability to upload a PHPhường tệp tin, for example with FTP or a web-based portal.

Create a file called php_version_check.php file with the following contents. 

Upload this tệp tin to lớn the root directory of your site. Once you’ve sầu done that, you should be able lớn access it at the URL (replacing with your own domain name name). It should produce output like that shown in the following screenshot.


phpinfo Security Risks

As you can see, the PHP version is displayed right on the top of the page. Also, it displays a lot of other important configuration information as well. This information can be very useful if you are setting up or debugging a PHP.. installation. It can also be very useful for hackers, allowing them to lớn pinpoint specific vulnerabilities in your system! 

That"s why I strongly recommend you remove this file from the server once you’ve finished checking the PHP version.

Learn PHPhường With a Free Online Course

If you want to learn PHPhường, check out our không lấy phí online course on PHPhường fundamentals!