Find PHP version on windows command line

后端 未结 15 1766
天涯浪人
天涯浪人 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: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.

提交回复
热议问题