Jump to content

Configure php.exe in VS Code


Go to solution Solved by gizmola,

Recommended Posts

I got this message, but I have no idea what to write where. I need a step-by-step guide to get this right.
Is it okay to use the php.exe that is in Laragon? In that case, php.exe is in the path and folder: C:\laragon\bin\php\php-7.4.33-Win32-vc15-x64\php.exe

Thanks for all your help, below is the image file with the error message: 

php_error_vs_code.png

Link to comment
https://forums.phpfreaks.com/topic/326669-configure-phpexe-in-vs-code/
Share on other sites

2 hours ago, PeterBubresko said:

I got this message, but I have no idea what to write where. I need a step-by-step guide to get this right.
Is it okay to use the php.exe that is in Laragon? In that case, php.exe is in the path and folder: C:\laragon\bin\php\php-7.4.33-Win32-vc15-x64\php.exe

 

Yes.  It wants a local copy of PHP on your workstation.

I do have to point out that PHP 7.4 was end of life 2 years ago now.  It would be best if you upgraded to a more current supported version of PHP ( > 8.1 at this point in time).

 

2 hours ago, gizmola said:

Yes.  It wants a local copy of PHP on your workstation.

I do have to point out that PHP 7.4 was end of life 2 years ago now.  It would be best if you upgraded to a more current supported version of PHP ( > 8.1 at this point in time).

 

Point taken Gizmola🫡 PHP on webhotel server is 8.4...🫣🫢 Now I am running 8.4.3 on local webserver too. (shame on me). So now Laragon PHP is upgraded.
Thanks for waking me up Gizmola

6 hours ago, requinix said:

You need to add [the] path [to php.exe] to [the] "php.executables" setting.

Open the VS Code settings, find "php.executable", and put the path to your php.exe in there.

Thank you for the solution requinix. I am sure it will work for others, but the problem stil resist for me. I read some about it, and it could be something about adding PHP to the windows path (or something), but i dont understand how to fix it because this Indian guy is talking so bad english and way to fast. Is the correct way using 2 \\ or one, on both the 

    "php.executables": {

   "PHP8.4.3 ": "C:\\laragon\\bin\\php\\php-8.4.3-Win32-vs17 x64\\php.exe",

 },    

    "php.executablePath": "C:\\laragon\\bin\\php\\php-8.4.3-Win32-vs17x64\\php.exe"

  • Solution
12 hours ago, PeterBubresko said:

Thank you for the solution requinix. I am sure it will work for others, but the problem stil resist for me. I read some about it, and it could be something about adding PHP to the windows path (or something), but i dont understand how to fix it because this Indian guy is talking so bad english and way to fast. Is the correct way using 2 \\ or one...

 

If the php.exe executable is in your windows path, you probably won't have to manually add the path to that configuration.  In fact you would likely need to delete the value from vscode.  

1st to understand what the path environment variable does.

When you try and run a program, windows will look for that program in the current directory.  If it is not found, then it tries to find it in the path.

So by design the path variable should have directories in it, NOT the full pathname to the program.

 

So in your example the path you want to add is:

C:\laragon\bin\php\php-8.4.3-Win32-vs17 x64\

 

Follow these instructions to add the location of your laragon php directory file to your system path:  

These directions were for Windows 10, but they also work for Windows 11.  

Make sure you don't overwrite your current path, but instead just edit it by adding the path to your php8x installation.

Let us know if that fixes the problem.  Make sure you restart Vscode after you have added the laragon path to your windows path variable.

  • Like 1
On 1/30/2025 at 1:46 AM, gizmola said:

So by design the path variable should have directories in it, NOT the full pathname to the program.

 

So in your example the path you want to add is:

C:\laragon\bin\php\php-8.4.3-Win32-vs17 x64\

 

Follow these instructions to add the location of your laragon php directory file to your system path:  These directions were for Windows 10, but they also work for Windows 11.  

Make sure you don't overwrite your current path, but instead just edit it by adding the path to your php8x installation.

Let us know if that fixes the problem.  Make sure you restart Vscode after you have added the laragon path to your windows path variable.

Thanks, Gizmola🥰 You saved my day. Not only this day, but a lot of days with troubleshooting.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.