How to set php executable path php.validate.executablePath in vscode when php is set inside docker container?

后端 未结 13 1340
既然无缘
既然无缘 2021-01-30 08:47

I have a development environment based in docker.

Everytime that I open VSCode I get this message:

Cannot validate since no PHP executable is set.

相关标签:
13条回答
  • 2021-01-30 09:18

    Download PHP, in my case, I downloaded from here: http://windows.php.net/download/

    Copy and paste the files to a location on your computer, and set the path:

    "php.validate.executablePath": "C:/php/php.exe"

    0 讨论(0)
  • 2021-01-30 09:19

    My case, I'm using Laragon, so you should search where is your php.exe.

    By VSCode just add.

    "php.executablePath": "C:\\laragon\\bin\\php\\php-7.2.19-Win32-VC15-x64\\php.exe"
    

    on settings.json.

    0 讨论(0)
  • 2021-01-30 09:21

    I had the same problem but found the fix here.

    In Windows:

    1. Go To System Properties
    2. Go To Advanced Tab
    3. Click "Environment Variables"
    4. Select Path
    5. Add a new path that points to your php 7 executable:

    0 讨论(0)
  • 2021-01-30 09:21

    If you get this on windows in VS code click on the blue 'open settings' button. Near the bottom of the screen this opens there's a link to enter the settings, click this to open the settings.json file. Edit the file to look like this:

    {
        "php.executablePath" : "C:/php-7.4.2-nts-Win32-vc15-x64/php.exe",
        "php.validate.executablePath" : "C:/php-7.4.2-nts-Win32-vc15-x64/php.exe"
    }
    

    where C:/php-7.4.2-nts-Win32-vc15-x64 is the path to your PHP dir

    0 讨论(0)
  • 2021-01-30 09:23

    Sure, easy. Just follow what it's says.

    Go to File> Preferences > Settings ... it will open the settings.json file.

    add the following code:

    {"php.validate.executablePath": "Here you put your PHP.exe path"}

    You have to know where te PHP.exe file is in your computer, search in the php>bin folder.

    Hope it works for you

    0 讨论(0)
  • 2021-01-30 09:26

    For linux users: if you don't have PHP installed then first download,
    then in terminal type

    $ whereis php

    and it will show path for php executable (It will be either in /usr/bin/php or usr/local/bin/php) which you can copy from terminal.

    In VScode goto settings.json file and paste

    php.validate.executablePath: /usr/bin/php

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