
6 ways to check your version of PHP
The quickest way to check your version of PHP
To check your version of PHP, simply run the php -v
command, no matter if you are running macOS, Linux, or Windows.
6 ways to check your version of PHP
Using phpversion()
To check which version of PHP you are running, you use the phpversion()
function. It returns a single string containing the precious information.
<?php echo phpversion(); ?>
Using phpinfo()
To check which version of PHP you are running, use the phpinfo()
function. It will show you a web page containing every bit of information you might need about your installation of PHP.
<?php phpinfo(); ?>
Using the terminal on macOS, Linux and WSL
To check which version of PHP you are running using your terminal on macOS or Linux, use the php -v
command. It’s simple and straightforward, the version of PHP is the first thing in the output.
php -v
Using the command prompt on Windows
To check which version of PHP you are running using your Windows command prompt, use the php -v
command. It’s as simple and straightforward as in the previous section.
php -v
Using Laravel’s welcome page
To check which version of PHP you are running using Laravel’s welcome page, just look at the bottom right corner. It’s that simple.
Using Laravel Artisan
To check which version of PHP you are running using Laravel, use the php artisan about
command. It will show you the version of PHP, including various information about your setup.
php artisan about
Did you like this article? Then, keep learning:
- Get insights on upcoming PHP 8.4 features and release date
- Overview of Laravel 12-ready books to advance your Laravel skills
- Review recommended PHP developer blogs to stay updated in 2024
- Learn how to lock PHP extensions versions with Composer and Docker
- Understand PHP 8.3's new Override attribute for clearer intent
- Stay updated with PHP 8.3 new features and breaking changes
- Explore PHP array emptiness checking methods to write better code
- Learn to print arrays in PHP and Laravel for easier debugging
- Discover how to reveal all errors in PHP for effective debugging
- Overview of Laravel Artisan command tool to boost development speed