XAMPP is the most popular PHP development environment. XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use. Download Click here for other versions. Go to the link to download VS Code for your respective operating system and platform. Open the downloaded setup file and install it. The installation process is pretty simple and self-explanatory. Next step is to install the XAMPP software. How to get comments count of each post, in a list of posts that is in a User Dashboard in Laravel; Laravel: How to check if table exists in database on view file; I.
To those who are using XAMPP, you can connect to the database through these steps:
$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.
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.
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.
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
Hope that helps!
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.
Posting to the forum is only allowed for members with active accounts.
Please sign in or sign up to post.