Running PHP on mac with XAMPP

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
guys i'm going to show you how to get a php application up and running on a mac computer i'm going to make a different video i'll put a link in the description for that for doing it on windows because there are some some differences between mac and windows and i might even do a linux one uh but chances are if you have linux then you probably already know how to do stuff like that but let's just go ahead and jump it into the mac version uh first thing we want to do is go to the internet let's go to google and you want to type in xampp okay um it's just this is the logo for that's x amp that stands for i think x stands for like cross platform because there's other ones like lamp and stuff like windows but this one is cross platform it is apache mysql php and pearl it actually says it right there so you just go go to it and uh click download for os x uh it'd be the same for windows but like i said if you're on windows you should be watching than the other video so you just download it here you go through the steps you drag it over to your application folder i mean it's it's very easy it's self-explanatory so once you have that downloaded if you just do command space and exam press enter it'll pop up and it'll look like this so the first thing we have to do is start the server uh you can see right now it's not running at all so we press start and the ip address is going to show up right here so let's give it a second and there it is okay the next thing we want to do is go to services this is where we're going to run our apache server our mysql database i wish we can go ahead and start all of these wait for them to turn green you don't actually have to wait i think you can go through and just do all this right away but i like to go ahead and wait and make sure that everything comes on uh we'll get to this part in a minute the network let me show you what mount does you see right here we if you go here you can't see where your your php files are because i'll show you where there are but they're not here right now but if you mount this pay attention to what happens over here i think it happens under the icloud if i remember right actually under locations okay now that we pressed mount this popped up this little ip address so if you click on it there's a lamp how do i get to all right there's this lamp folder and you can go over to htdocs now everything inside of this h everything you want to run on this server has to be inside of this htdocs folder so let's just go ahead and do this let's do a new folder and let's call it test okay so now we have a test directory inside of the htdocs folder which is going to be able to run our application so let's uh go ahead and get something wrote i'm going to use vs code i'm not going to worry about the command line or anything right now i'll do more in-depth videos but i want to just get you up and running because a lot of books you can you know you can watch videos and learn how to how to do the syntax and stuff like that but getting it started you know this little petty stuff here can take some time so i just opened up vs code this way there's a lot better ways to do it but we'll just go to uh open folder and we can see you know because we have this mounted we can click here we can go to the lamp directory go to htdocs and then we can open our test folder that we just created so we press open and now we are in it so we need to create a new file let's call it let's call it index.php and let's just do a php and i believe that we should just be able to go let's just do a print print yo what's up all right yo what's up okay so we don't really need this let's get this out of the way um let's move this let's go ahead and get this out of the way too we have it make sure it's saved and let's minimize it so now we're back to this xampp uh application that is mimicking a server that we can run on our local machine uh so what we can do is if you go back to general this ip address wasn't here until we press start so now let's take that and press command c or you just you know right click on it we're going to copy it then we're going to go to the internet i'm using firefox you can use safari google chrome whatever you have it doesn't matter so let's paste that ip address in and then you do slash and what you do is uh since we're in h docs if you do slash delete like this is another folder that i created uh that i was just doing some testing on then it would open up this folder but you'll see as we go it's kind of hard to explain but uh we're doing tests this is one we created so let's do slash test and then slash inside of test what did we have inside of test we had one file which is index.php that's the one we created so let's do index.php and then press enter and then look because we wrote that print statement yo what's up that's what's run this is actually running on a server this isn't your normal writing some html and some css and just dragging it into a browser where vs code so this is actually what we put in here so let's do another print sorry that is some other language we'll do hello again and let's save that and we'll update this and hello again let's actually do a let's print a line break we'll learn if you don't understand all this syntax is fine i'm we're going to get more i'm going to do a lot more php videos uh php is a very strange language it's kind of like a javascript thing where some it's just weird some things work some things don't and there's just so much stuff to do so you can see we actually inside of a php file we printed an html tag inside of the quotes like you know it's weird um there's ways that you can do things but doesn't mean it's the right way but that's just one example but like i said we'll get to all that this is just how you run a a php application on your local machine now if you were to want to launch this and you wouldn't be using xampp and we'll get into all that too but anyway let's one more thing here uh if we want to get into where we can manage our database and uh check all our users and all that stuff this is where we're going to need this so we want to do we want to come over to network it doesn't really matter which one you do but most people use the first one the localhost localhost 8080. so click on this one 8080 and then press enable so now what we want to do is go to that address so let's do localhost 8080 not local news localhost 8080 so localhost common 8080 slash php my admin and then it opens up this page here so what we can do on this is we can actually connect our code to so this is mainly for databases i mean when you get into more advanced stuff there's obviously a lot of more advanced stuff but when it comes to databases like for example we could press uh i thought i had one on here but i guess i deleted it oh it was it was this one here so check this out um well i'll just i'll show you to create a new one if you go to new you can go to here and create a database you can say my database that's not how you want to spell it but whatever you just type it in and then create and then we want to create a table and we'll just call it name and we'll do a column we'll do two columns because we will maybe want a first name and a last name press go and let's do first last this is going to be a var chart instead of an int you don't want to be in an end or a date you want var chart and if you do varchar you have to do uh length here and the highest you can go is 255 so most people just do 255 sometimes i'll do a little bit lower and then that's it you just press save and now we have a table as you can see here we have our database that we just created and we have the table inside of the data database and inside of that table we have two columns so two things that you can enter into it a first name and a last name so anyway i know that's so much stuff that's that's the key to learning how to do all these things it's not going through it's super slow trying to memorize everything it's really just jumping into it going through it over and over again and that's the way we're gonna i'm gonna run this ph this short php course here on youtube before the udemy course is completely done uh it's gonna be more about you learning instead of me just going through very slowly and making it to where you don't even want to continue so we're going to go through it quick but if you stick with it i'll never leave you out hanging not knowing what to do but you might have to go back and watch some stuff and figure it out for yourself so anyway that's it so quick rundown we use xampp we start the application it gives us a an ip address to go to so i like we got here i p address and then you have to do a slash to whatever you named your directory and then whatever file you have in uh in that directory so i mean we could put a new file in here and call it you know second dot php and we could change this index.php to second.php and it would go to that file instead so just remember that you got to uh you have to go to mount to see it over here and put it in h dot htdocs open it whichever one you created open that in your browser browser um and yeah that's it so you might want to watch this video go back and watch it again or i just rewinded if you got if you got lost along the way and um be pretty familiar with this because in the next videos i mean we're going to continue to be launching them from scratch like this but yeah i'm telling you i've seen so many people and including myself we get so far we start to get a little bit too advanced uh into into two advanced topics and we forget the basics i mean this is obviously a lot of stuff just to get something running on a local machine later in the course i'm going to take you onto aws which is amazon web services and show you how to actual actually launch it to where the whole world can see it and that actually gets a little bit more complicated than this and it's different so that's it for this video check out the next video and pretty soon you'll be on your way to writing real applications and even getting them launched so i hope you stick with it and i'll see in the next video
Info
Channel: Reevusk
Views: 7,196
Rating: undefined out of 5
Keywords:
Id: IBsn0NCOa-w
Channel Id: undefined
Length: 14min 4sec (844 seconds)
Published: Mon Apr 12 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.