YouTube Icon

Code Playground.

How to Check the PHP Version

CFG

How to Check the PHP Version

PHP is one of the most utilized worker side programming dialects. There are some significant contrasts between PHP adaptations, so knowing which variant is running on your worker may be fundamental in certain circumstances. 

For instance, on the off chance that you are redesigning your application or introducing another one that requires a particular PHP adaptation before beginning with the establishment, you'll have to discover the rendition of your PHP worker. 

In this article, we'll tell you the best way to check what adaptation of PHP your worker is running. 

Checking PHP version with phpinfo()

The most dependable method of discovering what adaptation of PHP is utilized for that particular site is to utilize the phpinfo() work, which prints different data about the PHP worker, including its form. 

In your site report root catalog transfer the accompanying PHP document utilizing a FTP or SFTP customer: 

phpinfo.php

<?php

phpinfo();

Open your program, go to yourdoman.com/phpinfo.php ,and the rendition of the PHP worker will be shown on your screen: 

When you discover what PHP rendition you have, either eliminate the document or limit the admittance to it. Uncovering your PHP arrangement to people in general can represent a security danger to your application. 

There is likewise another capacity that you can use to discover the PHP variant. Not at all like phpinfo(), the phpversion() work prints just the variant of the PHP worker. 

phpversion.php

<?php
echo 'PHP version: ' . phpversion();

Checking PHP form from the Command Line 

In the event that you have SSH admittance to the worker, you can utilize the PHP CLI twofold to decide the adaptation of your PHP. 

To get the worker form, summon the php parallel utilizing the - variant or - v alternative: 

php --version

The order will yield data about the PHP form and exit. In this model the variant of the PHP worker is 7.3.11: 

PHP 7.3.11-1~deb10u1 (cli) (built: Oct 26 2019 14:14:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.11-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies

On the off chance that there are numerous PHP forms introduced on the worker, when you run the php order, it will show the variant of the default PHP CLI, which may not be the rendition of PHP utilized on the site. 

Conclusion

Deciding the adaptation of the PHP worker is a moderately simple errand. 

In this guide, we have told a few distinct choices about the best way to discover the rendition of PHP that your worker is presently running. 

Don't hesitate to leave a remark on the off chance that you have any inquiries.




CFG