How to Tell What Version of Php Is Installed

Read Fourth dimension: 4 mins Languages:

Hither are some quick tips on how to bank check the PHP version on your computer or server.

At that place are several reasons why you want to check the version of PHP which is installed on your server. For instance, y'all might want to install PHP-based software and to check if the software requirements match the PHP version installed on your server. Or you might be a developer who wants to utilize a feature which is only available in specific versions of PHP.

There are a lot of dissimilar PHP versions, and they have some noticeable differences among them. With every new PHP version, new features are added and others are deprecated, so information technology'due south always skilful to know the PHP version you're using.

In that location are a few different ways to check the PHP version. Mainly, if y'all take SSH access to your server, you lot tin can use the command-line interface to cheque it. On the other hand, if you don't take last admission, I'll evidence you how to check the PHP version using the phpinfo function.

Check the PHP Version by Using the Last

In this department, we'll discuss how you could check the PHP version past using the command-line interface (CLI) in a terminal.

Cheque the PHP Version on Unix, Linux, and macOS

For *nix-based systems—Linux, Unix, and macOS—it simply takes a single control to check the PHP version. Go ahead and run the post-obit in your terminal.

You should meet an output like the following:

As you tin can see, this gives you comprehensive information most the PHP version which is installed on your server. In the above output, the 7.2.24 version of PHP is installed on the server.

Check the PHP Version on Windows

For Windows users, the same control is used to cheque the PHP version. But yous might get an error if you don't gear up the PATH environment variable first. You tin do that by running the set PATH command. Run the following commands, and make sure that you replace the {PATH_TO_PHP_DIRECTORY} placeholder with the directory path where yous've installed PHP. For case, if you installed PHP in the C:\software\php directory, yous need to run set PATH=%PATH%;C:\software\php .

If yous don't want to set the PATH environs variable, you could also get to the directory where you've installed PHP and run the php -five command from there.

So that was a brief introduction to the CLI selection to check the PHP version. In the next section, we'll discuss how yous could check your PHP version with the phpinfo role.

Check the PHP Version by Using the phpinfo Function

Yous can too use the phpinfo function, which prints detailed information about the PHP software on your server and its configuration.

This option is specially useful when you don't have SSH access to the server where your site is hosted. If yous want to utilise this pick to bank check the PHP version on the remote server, all yous need is the power to upload a PHP file, for example with FTP or a web-based portal.

Create a file chosenphp_version_check.php file with the following contents.

Upload this file to the root directory of your site. Once you lot've done that, you lot should exist able to access it at thehttp://example.com/php_version_check.php URL (replacing instance.com with your own domain name). It should produce output like that shown in the following screenshot.

The phpinfo Function The phpinfo Function The phpinfo Function

phpinfo Security Risks

As yous can see, the PHP version is displayed right on the superlative of the page. Besides, it displays a lot of other important configuration data besides. This information can be very useful if you are setting upwardly or debugging a PHP installation. It tin can also be very useful for hackers, assuasive them to pinpoint specific vulnerabilities in your organization!

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

Learn PHP With a Free Online Class

If you want to learn PHP, check out our costless online course on PHP fundamentals!

In this course, you'll acquire the fundamentals of PHP programming. You'll start with the basics, learning how PHP works and writing elementary PHP loops and functions. Then you'll build upwards to coding classes for simple object-oriented programming (OOP). Along the fashion, you'll learn all the most of import skills for writing apps for the web: you'll go a chance to practise responding to GET and POST requests, parsing JSON, authenticating users, and using a MySQL database.

Did you detect this post useful?

pittmannotne1935.blogspot.com

Source: https://code.tutsplus.com/tutorials/how-to-check-the-php-version--cms-35322

0 Response to "How to Tell What Version of Php Is Installed"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel