Php validate executablepath ubuntu

linux xammp Visual Studio Code configuration

I want to config Visual Studio Code (VSC) to work with php on linux (Ubuntu). I installed xammp for this purpose and I don’t know where to point this parameter on VSC php.validate.executablePath On windows the config path has to be like this: «php.validate.executablePath»: «c:/php/php.exe» Could you give me the full path to configure it properly ON LINUX? Regards

We could help if you simply installed those components (http server, mysql database system, php language) using standard packages. But not if you do a wild installation as xammp requires.

A «regular xammp instllation» bypasses the systems software management system. It is a «wild installation» with all the implications that brings. Why would one want to do that?

I’m using xammp on my computer as a sand box, that’s why I choose it. Can you give me the php path to visual studio code json config file?

2 Answers 2

This answer may change based on what flavor of Linux/Unix you are using, but if you are using Ubuntu like me, this is how I did it.

First and foremost, I know you’re using XAMPP, but do exactly what the error message says and install PHP7. You can do so by running sudo apt-get install php .

I know that goes against intuition. At first I thought «I have XAMPP installed, which installed PHP. Why do I need to install PHP?» XAMPP only includes the PHP runtime executables. In order to do development with PHP, you need to install the full environment. XAMPP will continue to use its built-in version.

Читайте также:  Php не выдавать ошибку

Once the install is completed, follow these steps:

  1. Execute whereis php . Example output below: php: /usr/bin/php7.0 /usr/bin/php /usr/lib/php /etc/php /usr/share/php7.0-json /usr/share/php7.0-opcache /usr/share/php /usr/share/php7.0-readline /usr/share/php7.0-common /opt/lampp/bin/php /usr/share/man/man1/php.1.gz
  2. In Visual Studio Code, click the cog in the bottom left corner and select Settings. On the right-hand pane, insert the following code. The version-agnostic path is used here: «php.validate.executablePath»: «/usr/bin/php»
  3. Press Control + S or click File -> Save

The final settings file should look like this:

// Place your settings in this file to overwrite the default settings < // Snip. other configurations overrides // Points to the PHP executable. // Use the version-agnostic value from the "whereis php" command above. "php.validate.executablePath": "/usr/bin/php" >

Источник

Setup your VSCode as PHP code editor/IDE

As you know VSCode became a so popular text editor which can be tuned up to any language development (JavaScript, C, C#, Java, Go, Python and many more). In this post we are going to setup one of the popular backend language, I’m talking about PHP.

Requirements

If you are a Windows user, you can skip installing PHP and Composer in a single step using Laragon, in case you are Linux/MacOS you can follow this guide: https://dev.to/manuelojeda/setup-a-php-dev-enviroment-with-laravel-valet-and-wsl-1pp6

After you have installed all the things mentioned, I suggest you to install this extension in your VSCode:

Settings Sync

This one will let you bring your VSCode configuration anywhere you need it, only vinculate your GitHut account and you are ready to go:
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync

After having all of this installed let is begin with the dance.

Settings at VSCode

First of all, let’s tell VSCode where is the PHP Path is. Go to Settings and type php at the search bar, then look for the section; PHP › Validate: Executable Path then click in Edit in settings.json:

Alt Text

Once you have opened, look of the line that it says: «php.validate.executablePath». If you have it, make sure your php installation path is there, in case you haven’t add this rule to your settings.json:

In Linux and Mac should be:

«php.validate.executablePath»: «c:/Program Files/php/php.exe»

After doing this preparation you are ready to install and make your VSCode be ready to do some PHP code, let’s roll!

Extensions

PHP IntelliSense

What this extension does is giving some help depending on what version of PHP you have installed (at least PHP 7) giving you the autocompletition that Intellisense do in Visual Studio.

PHP Namespace Resolver

This is extension give you the posibility to auto add a Class from another file with few steps and without the necessity of tiping it at the beginning of your PHP file:

Credtis to the author: Mehedi Hassan

phpcs

This extension linter you code and tells you what you need to have an overall standar for a PHP code made. Follow up the installation guide and enjoy having a PHP linter in VSCode.

Laravel Blade Snippets

This extension gives you some helpful snippets when you are coding some blade files for the views of Laravel.

Composer

This provides an interface to manage your Composer dependencies and validates your composer.json config file

Conclusion

With these extensions your PHP development will be boosted greatly and make Visual Studio Code a great free alternative in the market. I hope this post was helpul to you and I wish to you good luck in the path.

Источник

VsCode php.validate.executablePath, after insalled XAMPP

i’m trying to set the certain path for the php extension in my vscode (using linux) i started installing the XAMPP and after it..i tried to use the extension writing some php scripts(php extension INTELLISENSE and DEBUG), but the extension is not working properly and it’s showing that error: Cannot validate since /usr/bin/php is not a valid php executable. Use the setting ‘php.validate.executablePath’ to configure the PHP executable. i tried to set it using que path which is provided by vscode documentation, but it’s still no working. Can anyone help me !! please.

6 Answers 6

Php path in windows

And it’ll gives the path as (in my case)

I found a solution, typing in terminal

that returns the absolute path for set it in the vscode extension

Then, setting the path in the follow line

php.validate.executablePath: "/opt/lampp/bin/php", 

So, I hope this solution is helping someone behind the screen.

Just extending the answer by @Reinaldo Duguet with a ton of thanks to him !

If you are using Xampp, the PHP path can be found by running the local server and then typing localhost in the browser. This will open the Xampp dashboard. Click on phpinfo() and there you will get the exact path shown as Configuration File (php.ini) Path = /opt/lampp/etc

Please note that the path may very as per the PHP installation in your system. So you may have to use the respective path shown with above ways.

Then, to let VSCode know this path, open settings in VSCode and search for «PHP debug» and click on the PHP > Debug:Executable Path setting

Add the following line at the first place after «

Источник

Setting PHP Executable Path in VS Code in Ubuntu

Getting Unexpected ‘Unknown’ , ‘;’ expected. , ‘VariableName’ expected. error.

These kind of lines are causing error

namespace App\Http\Controllers; //Unexpected 'Unknown' and ';' expected Error use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Auth; 

Here, Screenshot of my error:

enter image description here

I’ve have added PHP executable path VS Code article. But still not working

php: /usr/bin/php8.0 /usr/bin/php.default /usr/bin/php /usr/lib/php /etc/php /usr/share/php8.0-mysql /usr/share/php8.0-readline /usr/share/php8.0-common /usr/share/php8.0-zip /usr/share/php8.0-xml /usr/share/php8.0-bz2 /usr/share/php /usr/share/php7.1-common /usr/share/php8.0-opcache /usr/share/php8.0-mbstring /usr/share/php8.0-gd /usr/share/php7.1-mcrypt /usr/share/php8.0-curl /opt/lampp/bin/php /usr/share/man/man1/php.1.gz 

Giving me following message

Cannot validate since usr\bin\php is not a valid php executable. Use the setting ‘php.validate.executablePath’ to configure the PHP executable.

1 Answer 1

I resolved with this executable path to configure the PHP executable in VS Code:

  < "php.validate.executablePath": "/usr/bin/php8.1" >whereis php php: /usr/bin/php /usr/bin/php8.1 /usr/lib/php /etc/php /usr/share/php /usr/share/php8.1-bcmath /usr/share/php8.1-xml /usr/share /php8.1-readline /usr/share/php8.1-zip /usr/share/php8.1-mysql /usr/share /php8.1-ldap /usr/share/php8.1-mbstring /usr/share/php8.1-common /usr/share /php8.1-intl /usr/share/php8.1-bz2 /usr/share/php8.1-gd /usr/share/php8.1- pgsql /usr/share/php8.1-curl /usr/share/php8.1-soap /usr/share/php8.1-opcache /usr/share/man/man1/php.1.gz 

Источник

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