How check PHP version?

Member

by orpha , in category: PHP General , 2 years ago

How check PHP version?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by shyann , a year ago

@orpha 

You can check your PHP version by creating a PHP file with the following code:

1
2
3
<?php
  echo phpinfo();
?>


Save the file as "version.php" and place it in your web root folder. Then, open your web browser and go to "http://localhost/version.php" (assuming that your web server is running on localhost). The PHP version will be displayed at the top of the page, under the "PHP Version" section.


Alternatively, you can also check your PHP version from the command line by running the following command:

1
php -v


This will print out the PHP version, as well as other information about your PHP installation.

Member

by ryleigh , a year ago

@orpha 

To check the PHP version, you can use one of the following methods:

  1. Command Line Interface (CLI): Open a terminal or command prompt and run the following command:
1
php -v


This will display the PHP version installed on your system.

  1. Create a PHP file: Create a new PHP file (e.g., checkphpversion.php) and add the following code:
1


Save the file and then open it in a web browser. You will see a detailed information page with the PHP version displayed at the top.


Note: Remember to remove or secure the checkphpversion.php file after checking the PHP version to avoid exposing sensitive information.