Home » How To Check Laravel PHP Version

How To Check Laravel PHP Version

Last updated on May 25, 2021 by

Sometimes, it’s required to check the Laravel PHP version for compatibility issues. It is always good to check the software versions before moving a site from server to server else you will get errors. It is also good to be up to date with the software for speed, security, and many more things.

So throughout this tutorial, we will see the different ways to check the Laravel PHP version. Let’s just take a deep dive into it.

Check Laravel PHP Version

01 Using php -v Command

There are many ways to check the PHP version with Laravel. But one of the easiest ways is to run the command. Open your command-line tool and type the following command to see your Laravel PHP version:

php -v

Output:

$ php -v
PHP 7.3.5 (cli) (built: May  1 2019 13:17:17) ( ZTS MSVC15 (Visual C++ 2017) x64
 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies

02 Using Composer Command

Composer can also tell you what version of PHP it’s running on. Run the following command in your command-line interface.

composer -vvv about

Output:

$ composer -vvv about

Reading ./composer.json
Loading config file ./composer.json
Checked CA file C:\Users\Maya\AppData\Local\Temp\ope66AE.tmp: valid
Executing command (D:\wamp64\www\demo): git branch -a --no-color --no-abbrev -v
Reading C:/Users/Maya/AppData/Roaming/Composer/composer.json
Loading config file C:/Users/Maya/AppData/Roaming/Composer/composer.json
Reading D:\wamp64\www\demo/vendor/composer/installed.json
Reading C:/Users/Maya/AppData/Roaming/Composer/vendor/composer/installed.json
Running 2.0.7 (2020-11-13 17:31:06) with PHP 7.3.5 on Windows NT / 10.0

You can see the PHP version listed in the last line on the above output.

03 Using which Command

The which php command is used to check which PHP version is running on the server.

which php

Output

$ which php
/d/wamp64/bin/php/php7.3.5/php

You can see in the above output, PHP version listed in a path.

04 By Creating A PHP File

Another easy way to check the PHP version by creating a .php file with the following content somewhere in your project which you can access with the URL.

info.php

<?php

phpinfo();

Now, access the URL with the file in your browser. You will now see the PHP version your server is running on like the below screenshot.

laravel php version using phpinfo function
Laravel PHP Version Using phpinfo() Function

05 Using phpversion Function

The phpversion() is used to gets the current version of PHP as the name suggests. Go to your PHP file and write down the following to print the PHP version.

<?php

// prints e.g. 'Current PHP version: 4.1.1'
echo 'Current PHP version: ' . phpversion();

Additionally, read our guide:

  1. How to Select Data Between Two Dates in MySQL
  2. Error After php artisan config:cache In Laravel
  3. Specified Key Was Too Long Error In Laravel
  4. AJAX PHP Post Request With Example
  5. How To Use The Laravel Soft Delete
  6. How To Add Laravel Next Prev Pagination
  7. cURL error 60: SSL certificate problem: unable to get local issuer certificate
  8. Difference Between Factory And Seeders In Laravel
  9. Laravel: Increase Quantity If Product Already Exists In Cart
  10. How To Calculate Age From Birthdate
  11. How to Convert Base64 to Image in PHP
  12. Check If A String Contains A Specific Word In PHP
  13. Dynamically Populate A Select Field’s Choices In ACF
  14. How To Find Duplicate Records in Database

That’s it from our end. We hope this article helped you to check the Laravel PHP version.

Please let us know in the comments if everything worked as expected, your issues, or any questions. If you think this article saved your time & money, please do comment, share, like & subscribe. Thank you for reading this post 🙂 Keep Smiling! Happy Coding!

 
 

Leave a Comment

*

code