leta91 / how-to-run-PHP-in-VS-Code-2022

How to run PHP on Visual Studio Code 2022 using WAMP software

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to run 🐘PHP on Visual Studio Code 2022 and how to fix some related bugs πŸ›:

You need 3 things to run PHP on your local machine:

  1. PHP
  2. a web server
  3. a database

The software that offers all 3 and that I found to be the best choice is WAMP πŸ₯‡

Open WAMP πŸ”½ go to C:\wamp64\www\newfolder πŸ”½ :file_folder: newfolder is the folder's name I created within the www folder (it's important to keep all PHP files inside the www folder in order for them to be opened) πŸ”½ select newfolder's path and type cmd and click Enter πŸ”½ within Command Prompt type code . this will set VS Code as the default text editor to open this specific folder with a PHP file πŸ”½ to access this file, type in the browser localhost that will show the homepage of all the folders within the www folder of WAMP, select the one that says newfolder ▢️ indexb.php indexb.php will show the output of the PHP code that in this case corresponds to the word Greetings

About bugs πŸ› here are the solutions to the error messages that you might get on WAMP when you left-click on your πŸ–±οΈ on the small WAMP icon that is located on the right side of the taskbar

  • default text editor does not exist

within the folder wamp64 open with normal notepad the file named wampmanager.conf and swap the previous text editor .exe to VS Code. Type on your computer the Windows key + R and type %appdata%..\Local\Programs\Microsoft VS Code

Add right after editor = in wampmanager.conf the path to VS Code that needs to have a similar syntax to the following C:\..\..\AppData\Local\Programs\Microsoft VS Code\Code.exe"

  • default log viewer does not exist

copy and paste the same .exe path after it says logviewer =

  • warning C:\wamp64 or PHP in PATH

in Windows search bar type environment variables and click on edit when you see on Path C:\wamp64\bin\php\php7.4.26 or something similar delete it and click ok. then right-click on πŸ–±οΈ and select exit on WAMP small icon. When you will re-open WAMP all 3 bugs will be fixed βœ…

About

How to run PHP on Visual Studio Code 2022 using WAMP software

License:MIT License


Languages

Language:PHP 100.0%