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 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
$ 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
which php command is used to check which PHP version is running on the server.
$ 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.
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.
05 Using phpversion Function
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:
- How to Select Data Between Two Dates in MySQL
- Error After php artisan config:cache In Laravel
- Specified Key Was Too Long Error In Laravel
- AJAX PHP Post Request With Example
- How To Use The Laravel Soft Delete
- How To Add Laravel Next Prev Pagination
- cURL error 60: SSL certificate problem: unable to get local issuer certificate
- Difference Between Factory And Seeders In Laravel
- Laravel: Increase Quantity If Product Already Exists In Cart
- How To Calculate Age From Birthdate
- How to Convert Base64 to Image in PHP
- Check If A String Contains A Specific Word In PHP
- Dynamically Populate A Select Field’s Choices In ACF
- 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!