Oh Dear is the all-in-one monitoring tool for your entire website. We monitor uptime, SSL certificates, broken links, scheduled tasks and more. You'll get a notifications for us when something's wrong. All that paired with a developer friendly API and kick-ass documentation. O, and you'll also be able to create a public status page under a minute. Start monitoring using our free trial now.

How to check which version of PHP you are running

Original – by Freek Van der Herten – 1 minute read

When working on open source code, I like using the latest version of PHP. When developers that are not on the latest version use the package, they might see syntax errors.

You might ask why Composer doesn't protect against this? When composer.json requires the latest version, how do devs, not on the latest version, can even install the package?

Well, there seemingly are a lot of people that only upgrade the PHP version on the command line. For handling web requests, they are unknowingly using an older version of PHP. Here's how to make sure you are on the latest version of PHP on both the CLI and for handling web requests.

On the CLI type this command to see your PHP version:

php -v

To check the PHP version that handles web requests, create a .php file with this content somewhere the public directory of your app.



Point your browser to that file. You will now see which version of PHP you are running. Don't forget to delete the file afterward.

Stay up to date with all things Laravel, PHP, and JavaScript.

You can follow me on these platforms:

On all these platforms, regularly share programming tips, and what I myself have learned in ongoing projects.

Every month I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.


What are your thoughts on "How to check which version of PHP you are running"?

Comments powered by Laravel Comments
Want to join the conversation? Log in or create an account to post a comment.