Find PHP version on windows command line

后端 未结 15 1695
天涯浪人
天涯浪人 2020-12-24 00:35

I just tried to know version of my PHP from windows command typing, C:\\> php -v But it is not working. It says php is not recognized as internal or ex

相关标签:
15条回答
  • 2020-12-24 00:37

    Nothing to worry it's easy

    If you are using any local server like Wamp, Xampp then Go to this Steps

    1. Go to your drive
    2. Check xampp or wamp server that you installed
    3. Inside that check php, if you got then go for next step
    4. You will find php.exe, Once you get php.exe then you are done. Just type the path like below, here i am using XAMPP and type v for checking version and you are done.

      C:>"C:\xampp\php\php.exe" -v

    Thanks.

    0 讨论(0)
  • 2020-12-24 00:38

    In command prompt type below

    set PATH=%PATH%;C:\path\to\php
    

    Where C:\path\to\php is the folder where your php.exe file is located. After this run

    C:\>php -v
    

    than you will see something like

    PHP 7.3.6 (cli) (built: May 29 2019 12:11:00) 
    

    UPDATE:

    If you find that when you restart your computer, this solution will not work anymore:

    Set the Path like as following:

    Step 1 - Click on the Windows icon

    Step 2 - Click on the Settings icon

    Step 3 - Click on System

    Step 4 - Click on About

    Step 5 - Click on System info

    Step 6 - Click on Advanced system settings

    Step 7 - Click on Environment variables...

    Step 8 - Select Path row and then click Edit

    Step 9 - Click New and then click Browse, then in the next panel which will open you need to select the folder you want in the Path. For the initial premise of this guide i will add the folder C:\Users\NewFolderInPath

    Note: Replace your PHP installed path(e.g:C:\Program Files\php) with the above path ♥.

    Step 10 - Click OK and click every OK button you will encounter to close every previous windows.

    0 讨论(0)
  • 2020-12-24 00:42

    You just need to find out where is your PHP folder.

    • If you are using XAMPP or WAMP then you will see a php folder.
    • You just need to go into the php folder using your cmd using command

    cd \xampp\php (FOR XAMPP)

    cd \wamp\php (FOR WAMP)

    • And then just type in this command

    php -v

    • Then you will see something like

    PHP 5.6.11 (cli) (built: Jul 9 2015 20:55:40) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

    0 讨论(0)
  • 2020-12-24 00:43
    1. First open your cmd
    2. Then go to php folder directory, Suppose your php folder is in xampp folder on your c drive. Your command would then be:

      cd c:\xampp\php
      
    3. After that, check your version:

      php -v
      

    This should give the following output:

    PHP 7.2.0 (cli) (built: Nov 29 2017 00:17:00) ( ZTS MSVC15 (Visual C++ 2017) x86 ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies

    I have uploaded a youtube video myself about checking the version of PHP via command prompt in Bangla: https://www.youtube.com/watch?v=zVkhD_tv9ck

    0 讨论(0)
  • 2020-12-24 00:49

    Just create a php file and write the code

    <?php
    echo phpversion();
    ?>
    

    and open the file in any browser. It will show the php version installed in your system.

    0 讨论(0)
  • 2020-12-24 00:50
    1. Open cmd
    2. Type php -v

    Output : PHP 5.6.30

    0 讨论(0)
提交回复
热议问题