Hướng dẫn php.validate.executablepath xampp mac

vscode requires path to php set for this parameter:

Nội dung chính

  • Not the answer you're looking for? Browse other questions tagged php mamp visual-studio-code mamp-pro or ask your own question.
  • Linux and macOS
  • PHP extensions
  • Disable built-in PHP support

"php.validate.executablePath":

so I specified this:

"/Applications/MAMP/bin/php/php7.0.12/bin/php"

but it isn't recognized.

What is the correct path ?

asked Nov 21, 2016 at 18:21

Robert BraxRobert Brax

5,7439 gold badges38 silver badges65 bronze badges

3

I ran into this problem after installing the PHP Intellisense extension in vscode. For Intellisense to work I needed to point vscode at MAMP's version of PHP, not the default OS X version of PHP, but it did not recognise the path I was specifying.

I was able to resolve the issue by specifying the "php.executablePath" preference instead of "php.validate.executablePath".

"php.executablePath": "/Applications/MAMP/bin/php/php7.4.21/bin/php"

Here is an explanation from the author of the package:

validate has nothing to do with this extension, but is the built-in validation of VS Code. I would disable that, because you will get duplicate validation. php.executablePath should be set to the path of the binary

answered Nov 28, 2017 at 11:28

Jonathan NicolJonathan Nicol

3,0601 gold badge19 silver badges22 bronze badges

I am using mac i have install php intellisense that required php version 7 executable path i have already php 7 installed. Terminal command

which php

work for me.

answered Sep 11, 2017 at 8:50

Abdul MananAbdul Manan

2,0753 gold badges26 silver badges51 bronze badges

2

Not the answer you're looking for? Browse other questions tagged php mamp visual-studio-code mamp-pro or ask your own question.

@JacobGunther12 $PATH did not solved the issue

@dbaeumer Not sure, at the office everything is Mac, so I just open "Application Manager" and start up the servers; I use xampp and I found php.ini at XAMPP/xamppfiles/etc/
However, there's no php.app or other file just named php.something

If I use the path "/Applications/XAMPP/xamppfiles/etc/php.ini" or "/Applications/XAMPP/xamppfiles/etc/" I get the a message saying "spawn EACCES"

SOLUTION:
The path is "/Applications/XAMPP/xamppfiles/etc/php.ini"; if you get the message "spawn EACCES" run in Terminal:
sudo chmod -R a+rwx /Applications/XAMPP/xamppfiles/etc

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Pick a username Email AddressPassword

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Studio Code is a great editor for PHP development. You get features like syntax highlighting and bracket matching, IntelliSense [code completion], and snippets out of the box and you can add more functionality through community-created VS Code extensions.

Linting

VS Code uses the official PHP linter [php -l] for PHP language diagnostics. This allows VS Code to stay current with PHP linter improvements.

Tip: Using XAMPP? Install the full version of PHP in order to obtain the development libraries.

There are three settings to control the PHP linter:

  • php.validate.enable: controls whether to enable PHP linting at all. Enabled by default.
  • php.validate.executablePath: points to the PHP executable on disk. Set this if the PHP executable is not on the system path.
  • php.validate.run: controls whether the validation is triggered on save [value: "onSave"] or on type [value: "onType"]. Default is on save.

To change the PHP settings, open your User or Workspace Settings [⌘, [Windows, Linux Ctrl+,]] and type 'php' to filter the list of available settings.

To set the PHP executable path, select the Edit in settings.json link under PHP > Validate: Executable Path, which will open your user settings.json file. Add the php.validate.executablePath setting with the path to your PHP installation:

Windows

{
  "php.validate.executablePath": "c:/php/php.exe"
}

Linux and macOS

{
  "php.validate.executablePath": "/usr/bin/php"
}

Snippets

Visual Studio Code includes a set of common snippets for PHP. To access these, hit ⌃Space [Windows, Linux Ctrl+Space] to get a context-specific list.

PHP extensions

There are many PHP language extensions available on the VS Code Marketplace and more are being created. You can search for PHP extensions from within VS Code in the Extensions view [⇧⌘X [Windows, Linux Ctrl+Shift+X]] then filter the extensions dropdown list by typing 'php'.

Disable built-in PHP support

To disable the built-in PHP smart completions in favor of suggestions from an installed PHP extension, uncheck PHP > Suggest: Basic, which sets php.suggest.basic to false in your settings.json file.

Debugging

PHP debugging with XDebug is supported through a PHP Debug extension. Follow the extension's instructions for configuring XDebug to work with VS Code.

Next steps

Read on to find out about:

  • Extension Marketplace - Browse the extensions others have shared
  • Debugging - Learn more about VS Code debugging

9/1/2022

//itlovedesign.blogspot.com/2017/07/fix-khong-chay-file-php-trong-visual.html

Đây là lỗi khi tạo 1 file php trong Visual Studio Code

Xử lý bằng cách vào File - Preferences - Setting , phần User Setting , thêm Path của file php.exe , sau đó nhán Ctrl +S để save kết quả

Khởi động Xamp lên và chạy thử

Bây giờ , xoá thử chữ php trong file php

Thì trình duyệt sẽ hiển thị 1 trang trắng

Muốn cho nó chạy tab php ngắn thì xử lý như sau

Vào C:\xampp\php tìm đến file php.ini edit nó với NotePad++,

sau đó tìm kiếm từ khoá short_open_tag, sửa lại như hình dưới

Save lại , sau đó Restart dịch vụ Apache lại

F5 lại trình duyệt 

Done :]

Chủ Đề