Run .php file in Windows Command Prompt (cmd)

后端 未结 4 403
灰色年华
灰色年华 2020-12-08 11:04

I want to run a .php file in windows cmd. I followed this (suggestion) php is not recognized as an internal command (in Windows)

But it did not work.

4条回答
  •  感情败类
    2020-12-08 11:44

    If running Windows 10:

    1. Open the start menu
    2. Type path
    3. Click Edit the system environment variables (usually, it's the top search result) and continue on step 6 below.

    If on older Windows:

    1. Show Desktop.

    2. Right Click My Computer shortcut in the desktop.

    3. Click Properties.

    4. You should see a section of control Panel - Control Panel\System and Security\System.

    5. Click Advanced System Settings on the Left menu.

    6. Click Enviornment Variables towards the bottom of the System Properties window.

    7. Select PATH in the user variables list.

    8. Append your PHP Path (C:\myfolder\php) to your PATH variable, separated from the already existing string by a semi colon.

    9. Click OK

    10. Open your "cmd"

    11. Type PATH, press enter

    12. Make sure that you see your PHP folder among the list.

    That should work.

    Note: Make sure that your PHP folder has the php.exe. It should have the file type CLI. If you do not have the php.exe, go ahead and check the installation guidelines at - http://www.php.net/manual/en/install.windows.manual.php - and download the installation file from there.

提交回复
热议问题