6 ways to check which version of PHP you are running

6 ways to check which version of PHP you are running

Published
Sep 2, 2023
Written by
Benjamin Crozat
0
comments
2 minutes
read

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()

Checking the 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()

Checking the version of PHP 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

Checking the version of PHP using the terminal on macOS and Linux.

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

Checking the version of PHP using Laravel’s homepage.

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

Checking the version of PHP 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
About Benjamin Crozat
Benjamin Crozat

Hi! I’m from the South of France and I’ve been a self-taught web developer since 2006. When I started learning PHP and JavaScript, PHP 4 was still widely used, Internet Explorer 6 ruled the world, and we used DHTML to add falling snow on websites.

Being able to educate myself for free on the web changed my life for the better. Giving back to the community was a natural direction in my career and I truly enjoy it.

Therefore, I decided to take action:

  1. I launched this blog in September 2022 with the goal to be in everyone’s Google search. I get more than tens of thousands of monthly clicks from it and even more visits overall (my analytics dashboard is public by the way).
  2. I also started growing my X (formerly Twitter) account at the same time, which has now over 7,000 followers.
  3. All the content I write is free thanks to my sponsors.

I also want to be completely free with my time and make a living with my own products. In April 2024, I launched Nobinge, a tool to summarize and chat with your content, including YouTube videos.

Believe me, I’m just getting started!

0 comments

You need to be signed in to comment this post.
Sign in with GitHub