PHP Tutorial (& MySQL) #2 - Installing PHP (XAMPP)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right they're my friends so the first step is to install PHP onto our computer so we can start to play around with it locally okay so we need to install PHP but we also need to install a database my sequel too because later on in the course we're going to be storing data in this my sequel database and that data would be something like user data or maybe football scores for a football website or even reviews for products or something like that and then PHP is going to communicate with that database when we need it to show it in the HTML templates okay and we'll delve into all of that stuff later on but either way that's two things we now need to install PHP and a my sequel database now we also need to think about how we're going to serve up our PHP files remember I said that PHP runs on a server so we're going to need some kind of local development server as well setting up on our computer to to run all of the PHP code on self has three things now we need PHP my sequel and some kind of local development server setting up now I guess if we have the predisposition to do so at the time we could install all of these things independently and set them up but I don't want to do that instead what I'm going to do is point you in to the direction of this tool called zamp which is going to install all of those things for you or you can pronounce it as xampp it's up to you but this stands for cross-platform that's the X so you can use on Windows or Linux or Mac Apache that's the server we're going to be using the local development server Mario DB this is just like a fork of my sequel it runs pretty much exactly the same way we'll be using that for the database PHP and perl this is like an added extra on the end okay so we're gonna install this and that's going to take care of all of those things that we need for us all we have to do is click the install button and by the way I will leave this link down below so you can click on that to go and download it click on this button to install it that's going to download it over here when that downloads just click it to run the installer alright then so I've got ahead and booted up that file that we've just downloaded the Installer so just click on next first of all these are the things we gonna install just leave those as is and click Next again this is where we're going to install it to so in the C Drive then the xampp folder click Next again and then I'm going to uncheck this to learn more about bit Nami and click Next again finally click Next again and that's going to start installing all of these different things onto your computer so when that's finished it's going to ask you if you want to start the control panel now keep that checked and click on finish so then choose your language and you're going to see this control panel right here ok so this is where we're going to be starting up the different services that we need we have PHP installed on our computer now so we can run that but we have this module right here Apache which is going to be our development server so we're going to start that up now we also have my sequel as well we're going to start that up later we don't really need that just yet and these are the two things we're going to be using right so we can see now this is green and it started up on port 80 so if we go now to admin then this is going to open up a web browser it's opened on my other screen so let me just scoot this over here and notice now at the top we've gone to localhost forward slash dashboard ok now if you get a port error at this point what you need to do is change the port number that Apache it listens to and I'll show you how to do that in a minute but anyway this page is being served up from that local development server that we just enable the Paget so this local hosting at the top this basically means our computer is being used as a server to send us this page normally when we go to a website URL we're communicating with a server somewhere else to get a web page back localhost just means that we're communicating with our own computer to get a web page back because Apache is running on our computer right so our computer now is acting as the server to send us back this web page now oftentimes when you develop locally on your computer you're going to be using this localhost to preview your website not just when using PHP but other programming languages as well so anyway let me first of all show you how to change the port number in case this is not working for you so what you need to do is go to config right here and then open up this Apache config at the top then just scroll down a little bit to where it says listen and you can see right here I'm listening to port 80 you just change that to something else for example if I say port eight zero nine zero and then save I'm going to cross that off if I stop this first of all then start it again and go to admin then scoot this across again first of all you'll get an error but if I now say localhost then colon and we said eight zero nine zero then enter now we get it okay so now the port number is listed up here so I'm actually going to go back into the config and I'm going to change this back to 80 to keep it as default but if yours doesn't work then you can change it right here and now if you have Skype installed on your computer I think that listens to port 80 as well so there might be some conflicts so you can always change it here or change the port that Skype listens to entirely your choice okay but either way now we've done that I'm going to start it up again we're listening to port 80 again so anyway this webpage over here this thing where is he actually coming from on our computer we know that we're using this local development server now Apache to serve this up but where is this webpage actually being served from on our computer well whenever we use xampp our web pages are being served from a folder called htdocs in the xampp directory and we can find that if we go to a file explorer go to see and then we installed it under xampp and we can see now htdocs right here okay so this is where all of our different stuff our web pages are being served from so inside this folder you can see this dashboard folder as well and if we click on there we're going to see down here we have an index file as well so this is the page that's being served right up here because we can see we're in the dashboard directory now by default if we navigate to a directory in the URL over here the server is going to look inside that directory and automatically try to serve up an index dot HTML file or an index dot PHP file if they exist and they do in this case we can see that right here okay it's an HTML document so it's automatically serving that up goto forward slash dashboard let me just do another test for you I'm gonna go back a Directorate and create a new folder and I'm going to call this test and then inside that I'm going to create a new file and this new file is going to be called test HTML so I'm going to go down to text document and call it test dot HTML now I'm gonna double click to open this and just say hello and save that now if I cross that off and go to now forward slash test and press ENTER then we're going to get this thing right here now we see this texting on the end of this that's actually because this is a text file so what I'm going to do is delete this and I'm going to go to new again and I'm going to create another text file this time I'm gonna double click and I'm gonna say hello and I'm going to say file save as and then go to all files instead of text document and I'm gonna save it as index.html this time and this should work so save that and if we hit enter again now we automatically see that index dot HTML file because it's gone to this directory right here it's automatically serving up that index file because it can find it okay so if we go to just localhost without the forward slash dashboard if we click enter then we still get this page and we can see it's changed to dashboard up here so what's happening there well that's because when it goes to forward slash without the dashboard it's looking in here and it finds this index file right here okay now what I'm going to do is just open that file up inside sublime so open file and I'm going to go to Windows then xampp and then into htdocs' and then i'm going to open up this file right here so this here is some PHP code that is running so when we go to just local host without forward slash dashboard it's finding this index.php file and it's running that on the server and it runs this code now don't worry too much about what this code looks like or what it's doing but essentially this line here is reader wrecked in goes to forward slash dashboard which is why we then get directed to forward slash dashboard and we get that index file inside the dashboard instead okay so anyway and no maybe a lot of this stuff maybe didn't make sense but now what we have is we have the Apache server installed on our computer so we can now run PHP files on our computer using this server and serve up files to the browser as well so now we've got all that stuff sorted in the next video we're going to create our very first PHP file and run that on our computer
Info
Channel: The Net Ninja
Views: 206,840
Rating: undefined out of 5
Keywords: php, tutorial, php tutorial, php tutorial for beginners, mysql, mysql tutorial, mysql tutorial for beginners, sql, sql tutorial, php for beginners, learn php, php mysql, php and mysql, XAMPP, XAMP, MAMP, WAMP, install PHP, install MySQL, install php and mysql, install xampp, how to install php, install php windows, install php mac, php setup
Id: 3B-CnezwEeo
Channel Id: undefined
Length: 9min 29sec (569 seconds)
Published: Tue Jan 29 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.