How to check what PHP version I am running

If you are a Linux command line lover you can run this and see what version of PHP you are running:

or you can alternatively run this to get strictly the version number

Find PHP version on Windows

php -v  is also working on Windows platforms. You can just start you CMD and run it to see the PHP version you currently have installed.

This will not work if you did not included the php.exe into the system path. So if this is you case you will have to locate php.exe on your system. Main is located here: C:\xampp\php  so I wil run the set command using this path like this:

Now run again php -v  and you should see you PHP version.

Find PHP version when you do not have access to a SSH console.

When you do not have access to a command line console you can find PHP version using the phpinfo() function.

Just put it in a new .php file and access it via your URL.

Or just simpler way is to use the phpversion()  specific function or the PHP_VERSION constant.

Why do I need to know my PHP version

There are plenty of reasons Why you may be interested in the PHP version you are running. One wold be that some functions are not available on some packages and other functions are deprecated on others.

If you want to know you PHP version adn do something or sommething else depending of you release nuber you may be interested in using the compare like this.

Hope this helps you

3 thoughts on “How to check what PHP version I am running”

  1. Hi no matter that I try all these things you mentioned I cannot find php.ini file.

    What I am really trying to do is ad the mcrypt extension.

    Here is error msg I am getting:

    ‘1’ is not recognized as an internal or external command,
    operable program or batch file.

    I never see a ‘1’ so no idea what this is referring too

    Thanks for any help

Leave a Reply

Your email address will not be published. Required fields are marked *

five + eight =