Xampp Visual Studio Code

Installing XAMPP, VS Code + Environment Setup PHP Tutorial #1

Download and Install XAMPP for PHP 5.X for Windows- Be sure to select the proper version of PHP as there are many choices. In Visual Studio Code, go to File-Open Folder and open xampphtdocs (Where you did put your PHP Files). In the Visual Studio Code Explorer you will now notice a MYSQL drop down tab at the very bottom.

Introduction to this Course

  • Visual Studio Code. Installing XDebug on anything for VSCode in 5 minutes; Install the PHP Debug Adapter for Visual Studio Code. Debug PHP In VSCode With XDebug; Adobe Brackets. Install the PHP Debugger for Brackets. Sublime Text 2 and 3. Install the Xdebug Client Package; Start debugger from the console. Enter cmd: set XDEBUGCONFIG='idekey=xdebug' php test.php.
  • Issues with localhost:8080 port in my XAMPP - Visual Studio code stack. Ask Question Asked 3 months ago. Active 2 months ago. Viewed 95 times 0. After I've updated my Windows 10 my XAMPP got 'Port 80 in use by 'Unable to open process' with PID 4!' Browse other questions tagged visual-studio-code localhost or ask your own question.
  • Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform.
  • PHP in Visual Studio Code. 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. VS Code uses the official PHP linter (php -l) for PHP language diagnostics. This allows VS Code to stay current.

In this series of videos, you will learn Php from starting to the very end. If you are a beginner in the world of PHP programming or even unfamiliar with coding, these video tutorials will help you to develop and deploy your own website using Php.

Outlook for mac text to speech disabled. Before getting our hands dirty with PHP programming, let's set up the tools and environment necessary for this session. The exact installation instructions are provided in the video but I will mention the tools we installed quickly for your future reference.

You will have to download a Microsoft code editor named Visual Studio Code (or any other source code editor of your choice). It is one of the best code editors that provides a very smooth programming experience. There are a lot of other features that make this editor one of the best, like colored keywords, files, and folder navigation panel, syntax autocomplete, etc. But since I have already made a video on VS Code I will not talk a lot about it here. The other thing I installed for working with PHP code is XAMPP. XAMPP is a free and easy to use Apache distribution containing Maria DB and PHP. I have used it through this Php Course. The XAMPP open source package has been designed to be incredibly easy to install and easy to use. Let's see how we can get these softwares quickly into our computers.

VS Code

1. Go to the link https://code.visualstudio.com/download to download VS Code for your respective operating system and platform.

2. Open the downloaded setup file and install it. The installation process is pretty simple and self-explanatory.

The next step is to install the XAMPP software. It provides interpreters for scripts written in the Php, along with server solutions.


1. Go to this link to download XAMPP according to your OS and platform.

2. Open the downloaded setup file. Follow the setup wizard and install XAMPP .

3. Run XAMPP after the installation. Start MySQL and Apache server by clicking Start in front of it. (This has been practically done and explained in the video)

Note: If you face any issue while starting the servers in step 3 regarding Port 80, make sure port 80 is not being used by any other application such as Skype. You can check the port usage stats in the Resource Monitor of the windows OS.

Open web browser, type localhost/phpMyAdmin in the address bar, and hit enter. The phpMyAdmin page will open, proving that the installed softwares and other things are working right.


To those who are using XAMPP, you can connect to the database through these steps:

  1. Go to the xampp > apache > conf, then open httpd.conf using your editor.
  2. Search for 'Listen' and find the one that doesn't have a # before it. Change whatever number you have there to 3306. (i.e. Listen 3306)
  3. Search for 'ServerName localhost' and change the number to 3306 as well. (i.e. ServerName localhost:3306)
  4. Save and exit.
  5. Now type this in your editor:$db = new PDO('mysql:host=localhost;dbname=database;port=3306','root',');

Hope that works!

Dennis Amiel Domingo Great tip! Do you know if there is a way we can access Xampp directly through the code editor? I have Xampp and Visual Studio Code but would like to run everything from VSC if possible?

After some research I found a solution that worked for me.

  1. Download XAMPP
  2. Start mySQL in XAMPP, it should be on port 3306
  3. In Visual Studio Code download and enable the extension 'PHP Server' by baprifa (Ignore this step if you already have, or if are using a different php server. This is the one I happen to be using)
  4. In Visual Studio Code download and enable the extension 'MySQL - MySQL management tool' by Jun Han
  5. Reload Visual Studio Code to ensure it's activated.
  6. In the Visual Studio Code Explorer you will now notice a MYSQL drop down tab at the very bottom. There should be a localhost database in there. If it's not appearing or shows an error, open XAMPP again to make sure you started mySQL
  7. You should now be up and running. To upload the project to phpMyAdmin in XAMPP, open the database.sql file that was downloaded from treehouse for the project. Right click anywhere on the document, and select option that says 'Run MySQL Query'.
  8. You can verify you are connected by opening the XAMPP control panel, Start the Apache Server, Open Web Browser and type localhost
  9. It will bring you to XAMPP page hosted locally on your computer. From there click phpMyAdmin link. On the left hand side verify that your database was uploaded.

NOTE: in this exercise the teacher is using the SQLite (PDO) driver. Instead, you will need to use the MySQL (PDO) driver.

To test that everything is working, in the inc folder, create a connection.php file. This is the code I used to test:

After saving it, right click and choose PHP Server: Serve Project to view.

NOTE: If both the Apache Server in XAMPP, and PHP Server by baprifa in VS Code are running, the PHP Server will be the one that works. To use phpMyAdmin you must stop the PHP Server.. at least that's how it is on my system.

Conectar Visual Studio Code In Xampp

I hope this info is helpful. I am new to this, so if there is anyone with more experience who would like to add or correct anything I may have typed, please feel free to comment.

Visual Studio Code Xampp Php

Thanks jaycode! Unfortunately, I'm not that familiar with Visual Studio Code. You may wanna try this link: https://www.youtube.com/watch?v=eE6oxEhqqoU

Xampp Visual Studio Codes

Hope that helps!

Xampp Visual Studio Code Xdebug

Thanks Dennis. I've seen this before. It's a good video but is for php debug. I would like to connect Visual Studio Code to phpMyAdmin (The one from Xampp) . I am not sure if this is possible.

Xampp Visual Studio Code Download

Posting to the forum is only allowed for members with active accounts.
Please sign in or sign up to post.