Php validate executablepath vscode linux

Как задать правильный путь в VSCode phpvalidateexecutablePath?

теперь попробуйте в терминале набрать php -v , в любой папке. Если выдает версию, значит видит.

Второе:
почему в путях PATH у Вас C:\Program Files (x86)\OpenServer\ , а в настройках VSCode Вы указываете ? У Вас что в разных папках копии php.exe? Тогда внимательно смотрите какой php.ini Вы правите. Вообще жедательно в одном месте иметь по одной копии

Пычев Анатолий, в том и дело, что он версию всегда выбивал таким образом.

Про PATH: путь там — это видоизмененный исходный путь. Изначально я поправил его на аналогичный json-овскому, но никакого толку. В итоге решил оставить как было, поменяв лишь папки. Копий нет, все в одном месте.

В общем, вопрос частично решен, но, конечно, Майки умеют делать «френдли» интерфейсы для новичков.

Если кому интересно, примерный ход решения был таким: я разрешил доступ всем пользователям компьютера и сторонним системам к папке ОпенСервера, потом в VSC воспользовался GIT-ом и открыл репозиторий-папку, в которой лежит нужный мне проект. По итогу ругаться он вроде как перестал (Но уведомления от IntelliSense все еще задалбывают) и даже выбил .json файл, про который все писали в гайдах, что я находил(с конфигом репозитория), в котором надо было поменять ссылку на проект. Всё, теперь отладка заработала. Правда потом ГИТ сбил автоисправление кода(Расширение из магазина, не помню название), так что да.

Спасибо за помощь. Всё же наверное стоит выбрать phpStorm для разработки на Пыхе.

P.S. Ничего сложнее подключения композера, GIT, настройки этой дребедени с отладкой, а также попыткой установить и разобраться как запустить, куда кидать и где использовать фреймворк я за всё время обучения ещё не встречал и, видимо, уже не встречу (Обязательно перечитаю это года через 2-3).

Наверное все зависит от проекта. Когда надо что то быстро поправить, то разворачивать PHPStorm . . хотя что там его разворчивать.

Но я успешно пользуюсь VSCode для php. Все легко, настройки возможны как глобальные, так и для проекта(рабочей области). Родной intelisence отключен в пользу расширения PHP Intelephense.
Из плагинов для php установлено только это . Для меня хватает с головой. Также настроен code sniffer, но я его включаю уже в конце и code beautifier (включен постоянно, т.к. форматирует сразу по настроенному стандарту). Редактор живой работает быстро.
Как рекомендация при установке расширения ВНИМАТЕЛЬНО читайть документацию по настройкам.

Попробуйте добавить в PATH путь к вашему php файлу, причем у меня добавлено как для пользователя, так и глобально. Запустите терминал в любом месте и выполните php -v

Источник

How to setting php.validate.executablePath? #533

Comments

karl20888 commented Nov 24, 2015

How to setting php.validate.executablePath?

The text was updated successfully, but these errors were encountered:

Читайте также:  Как узнать свой порт windows 10

dbaeumer commented Nov 24, 2015

If the php executable is not on your path you can use the setting to point to the php executable. For example

karl20888 commented Nov 25, 2015

Shirish-FrontEndDev commented Dec 5, 2015

Not Working

Shirish-FrontEndDev commented Dec 5, 2015

I am sorry the file ext was wrong

mattid89 commented Aug 15, 2016

What another settings do I need to debug php code?

dbaeumer commented Aug 15, 2016

There is currently no out of the box support to debug PHP. You might want to look if an extension is available.

mattid89 commented Aug 16, 2016

Hettar commented Oct 13, 2016

Try that:
php.validate.executablePath=»C:/apps/php/php.exe»

TRE8 commented Nov 30, 2016

How would I achieve this on my Mac running Mamp?

I’m trying
«php.validate.executablePath»: «

Exevium commented Mar 15, 2017

It doesn’t work for me.

dastani commented May 2, 2017

hi,
open file setting.json
<
«php.validate.executablePath»: «C:\xampp\php\php.exe»,
«php.executablePath»: «C:\php7.1\php.exe»
>
🙂

cp1001 commented May 10, 2017

on mac,add setting to setton.json:
«php.validate.executablePath»: «/usr/local/php5-7.1.4-20170506-100436/bin/php»

muganwas commented Jun 30, 2017

@only1shirish super helpful, I couldn’t make sense of anything anyone was saying.

Nathan-Hanlon commented Jul 5, 2017 •

I have tried everything on here but it is still not debugging or running or doing anything really

dbaeumer commented Jul 6, 2017

@Nathan-Hanlon which OS are you on?

8sam commented Jul 27, 2017

I went to my workspace settings and typed php.validate.executablePath: «c://Users/User01/data/php.exe» but its not working even then.

knucklejames commented Aug 4, 2017

I’ve tried a few paths for PHP binaries on OS X, none of them seem to work. Visual Studio is finding PHP 5.6 somewhere on my computer and it’s sticking to it, regardless of my settings.

The error I get is «The language server needs at least PHP 7 installed. Version found: 5.6.30».

Here are the different paths I’ve tried to give it:

Atom uses MAMP’s php binary just fine. Visual Studio Code ain’t having it. ¯_(ツ)_/¯

Источник

PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting

I’m running windows 10 fresh copy and I just installed visual studio code. I was trying to develop a PHP project using VS Code. But I’m having trouble in setting up the environment.

I saw a blog post and I downloaded the binary file of PHP 7 and place it in the «C» drive. Then I set path variable too.

But still, I’m getting this issue.

8 Answers 8

You installed PHP IntelliSense extension, and this error because of it.
So if you want to fix this problem go to this menu:
File -> Preferences -> Settings
Now you can see 2 window. In the right window add below codes:

Just like below image.

NOTICE: This address C:\\wamp64\\bin\\php\\php7.0.4\\php.exe is my php7.exe file address. Replace this address with own php7.exe .

For those who are using xampp:

File -> Preferences -> Settings

This one also works

Remove the «php.executablePath» line from the VS code settings.

Then add the xampp php path to the System variables

After that restart the Visual Studio Code

After adding php directory in User Settings,

If you still have this error, please verify you have installed :

64-bit or 32-bit version of php (x64 or x86), depending on your OS;

some librairies like Visual C++ Redistributable for Visual Studio 2015 : http://www.microsoft.com/en-us/download/details.aspx?id=48145;

To test if you PHP exe is ok, open cmd.exe :

If PHP fails, a message will be prompted with the error (missing dll for example).

Try this . This will solve your problem for sure!

Method 1 —

Step 1 — Go to ‘Environmental Variables‘.

Step 2 — Find PATH variable and add the path to your PHP folder.

Читайте также:  Блокировка диспетчера задач windows

Step 3 — For ‘XAMPP‘ users put ‘C:\xampp\php’ and ‘WAMP‘ users put ‘C:\wamp64\bin\php\php7.1.9’ ) and save.

Method 2-

In VS Code

Open ‘settings.json‘ file and put the below codes.

If you are using WAMP put this code and Save.

If you are using XAMPP put this code and Save.

Note — Replace php7.1.9 with your PHP version.

Источник

«Cannot validate the php file. The php program was not found»

I’m a beginner in PHP and want to use the VS Code editor. However, when I first save my php file I get this message:

Cannot validate the php file. The php program was not found. Use the ‘php.validate.executablePath’ setting to configure the location of ‘php’

What is the problem?

11 Answers 11

First, go to File->Preferences->User settings, A window will come like below image.

Now change the setting.json file like below image and save:

If PHP is not installed in your system, download php from here: windows.php.net/download, unzip to C: drive, set «php.validate.executablePath»: «C://path.to.your.php.folder//php.exe»

If php is installed in your system simply set the path of your php.exe file like below:

hint: In my case I use XAMPP which is installed in the D: drive, so my setting is below

Mind the double forward slashes.

I solved it by adding lines

Perhaps it is a syntaxis issue. After many tries I found that the command had to be written

(with 2 backslashes). I noticed that many answers said that a normal slash (/) or just one back slash worked as well. I have the Visual Studio Code version 1.17.0-insider x64.

The solution worked independently of the location of the executable file. Which in my case was located in C:\xampp\php\php.exe and ‪C:\Program Files\PHP\v7.1\php.exe.

there is a fast way for fixing this, just

  1. Search in Cortana : web
  2. Open Microsoft Web Platform Installer
  3. Search in Microsoft Web for «php»
  4. install one of php versions like php 7.0.5 or php 5.6
  5. if your install be successful, now your system have php and you won’t see php error in visual code.

this is work for me.

if you have installed php, please add path of installation php on path windows enviroment variable.

if you not install php yet, please follow this step:

  1. Install php and copy path installation. ex : C:\XAMPP\php
  2. go to System > Advanced System setting > Enviroment Variable > User Variable > Path > Edit > New > paste the path

First, go to File->Preferences->settings->User settings tab->extensions->from the drop down select php->on the right pane under PHP › Validate: Executable Path select edit in settings.json.

Then set the path as your case may be e.g for a xamp user who installed xammp on c drive you will have:

If php is installed in your system independently or by other means simply set the path of your php.exe file like below:

VS Code is looking to validate your code using php, and it is not finding php installed on your system.

If you install php to your path (That is to say, in a command prompt window you can type «php» in any folder and something will happen), everything should work.

Otherwise, you can do one of two things:

  1. Set the «php.validate.executablePath» setting in VS Code to point to the php executable on your system, wherever it may be.
  1. Ignore the error, but you won’t get proper error detection as you code.

How you can fix this:

If you have installed xampp for making a localhost database this is for if your new to php and are getting the error in the picture and this is how to fix it. I am using visual studio code.

How to get rid of error:

Читайте также:  Windows 10 this computer on desktop

1) Get to settings:

Method 1:

  • Click the button that says settings on the error (bottom right corner of the error)

Method 2:

  • Click the shortcut for settings ( ctrl + , ) ( if doesn’t work resort to method 3 or 4 )

Method 3:

file > preferences > settings

file (top left next to icon of visual studio code) image of where to click method 3,1

preferences (near bottom under auto save) image of where to click method 3,2

settings (the very top option) image of where to click method 3,3

Method 4:

Click cog icon (bottom left under the account icon/person) image of where to click method 4,1

Settings (second option from top) image of where to click method 4,2

Now you should be in settings and it should look like this:

UNLESS you did method 1 in how to get to settings, And you clicked on the button that said settings on the error message, I cannot include anymore pictures, read carefully.

2) Get to JSON file to resolve error:

Method 1:

  • Click the underlined text that says edit in settings.json (it should be right in front of you nearly in the centre of the screen)

Method 2:

  • Click the <> or paper with the arrow suggesting turning over the paper, When hovering over it, it will say open settings (JSON) (you will find it under the minimize screen button in the top right corner of the screen)

3) Enter this code:

Method 1:

You should be using xampp because this tutorial is for that specific control panel.

Inside the main JSON brackets ( <> )

Add this to the end:

Method 2:

If using a different drive simply change the C: to whatever drive it is e.g. D:

If still getting the error change the path so it works for you, you want to locate the php.exe or just PHP and the file class will be «application» ,

Then route the exe to the PHP using the path you took to locate the php.exe «application»

Remember you start at your drive so it should always start with C: (the drive you saved the xampp in)

4) Now save and close Visual Studio Code and re-open it

I hoped this helped if not I am sorry but this worked for me after looking around for a bit.

Also, that only works if you open a folder in VS Code, you can’t set it up to view a single file. Since VC creates a «.vscode» folder with a settins.json inside of it when you edit Preferences > Workspaces. This is where you could specify the php.validate.executablePath.

So keep that in mind, if you just open a single file, you can’t use that functionality but it will still show the warning. Instead open the folder the file is in.

If you want to never have to worry about it, then modify your %path% environment variable to include the folder that php.exe is in.

I was in the same situation. I’m using PHP through a docker (using Visual Studio Code). I didn’t want to install PHP on my PC.

The solution that worked for me was to download a portable server that executes PHP (www.uwamp.com). You will download it as a zip file (no installation or configuration needed) and save it somewhere on your PC.

Follow these steps:

  • download zip file from: https://www.uwamp.com/file/UwAmp.zip
  • unzip and save to any folder on your PC like: C:\Data\UwAmp
  • get the url to the php.exe file inside UwAmp > C:\Data\UwAmp\bin\php\php-7.0.3\php.exe
  • open Visual Studio Code and go to: File > Preferences > Settings > Open Settings (JSON) (you will have to click the icon at the top right corner)
  • Add following reference to the bottom of the settings.json file:
    «php.validate.executablePath»: «C:\Data\UwAmp\bin\php\php-7.0.3\php.exe»
  • save (you may possibly have to restart Visual Studio Code)

Источник

Оцените статью