How to Run PHP in Visual Studio Code (2024) - VSCode Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to this video guys in this video I'll show you how you can properly run and write PHP code in Visual Studio code so I have this project here it's just a normal HTML page and a login page now if I run this by going to the project folder I see this and if I do something here I'll get this error or this PHP page is just printed and but it is not executed or if I try to run this from within my vs code by doing right click and clicking on open in default browser I'm going to see the same issue here as you can see phsp code is not executed but it is just printed or if you have some extensions you might right click on it and click on open with live server and if that is the case you will see another error that is this so let's see how we can fix all of these errors and it's a single thing that you need to do and all this will be fixed now this is occurring because our browser doesn't know or our server doesn't know what to do with the PHP code so what we need to do is we need to install PHP in our system and then our server will know how it will handle that file so first we need to go to this URL you can click on the link in the description below and you'll be taken to this page and if you're on Windows just click on this ZIP file or this ZIP file anything will do so I'll click on this ZIP for now and let's wait till this is downloaded so once this is downloaded we need to move this to another folder so I'll just move it to my this folder here and paste it here click on continue and once this is here right click on this and let's click on extract all and let's change this folder name to just PHP because we will need to use this click on extract and let's wait till everything is extracted and now we have our PHP here so PHP is sound set up here now what we need to do is we need to go inside this folder and copy this and we need to add this to our inment variable so that our PHP files can be executed so press windows and search for environment variables click on inment variables double click on this path here and here click on new and paste our path here and click on Okay click on okay again click on okay again and finally let's go to our vs code now I have a PHP code here and I have an HTML page here so my login credentials are handled by the PHP page this so now go to this extensions and search for PHP server search again and now you will see this PHP server with this page here now what you need to do is in your case you will be seeing this install button here just click on install and it is installed now go back to your login. HML or your homepage just right click on it and click on PHP servers or project or you can click on this button here so I click on this and now we have our page open here so now if I write username and password and hit enter as you can see we are inside our welcome page so this is how you can set up PHP and visual studio code and run PHP code if you have any questions let me know in the comments below
Info
Channel: The Code City
Views: 848
Rating: undefined out of 5
Keywords: run php in vscode, run php in visual studio code, php in vscode, setup php in vscode, php development in vscode, php development in visual studio code
Id: OOKff8MF3k8
Channel Id: undefined
Length: 3min 44sec (224 seconds)
Published: Fri Feb 23 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.