Setup a PHP Environment using XAMPP

Hey guys welcome back in this video we will look at installing the XAMPP server application. As mentioned before, as is the most popular PHP development environment and the litters really stand for Apache which is the web server, Maria DB or MySQL, PHP and Perl. Here I have navigated to the websites and the link was a direct link to the download page is included in the resources for this video. But here it is Apache friends dot orgy and from here we can go to download and proceed to download some free of cost as it is open source and free for public use. So just go ahead and download that and we can reconvene when that process is completed. Having completed the download, we will be met with The setup and it’s fairly straightforward. I’ll just go ahead and click Next. We don’t have to change anything here as all of these are either essential or very nice to have. As you can see the Apaches by default grayed out because it makes no sense to install XAMPP without Apache, but we can leave everything else ticked. And we can just go ahead and click Next, we can go ahead and proceed with the default folder. If you have another folder that you wish to use, then that’s fine. But essentially, this is where all of the server PHP and by SQL files will be deployed to, and ultimately where we will need to put our sights for hosting on the web server. But we will just click next and go ahead and proceed through the installation. Alright, so here we see that bitnami is going ahead and promoting some modules to us. For example, we don’t need those right now. These are like ready made applications for us. But we don’t need those right now. So we can just go ahead and click Next to go ahead and install. At the end of this setup process, we can just go ahead and finish. And we can choose Well, our language I’m sure they have language packs for if you’re neither English speaker or German speaker no at the end of the set of the associate who wanted to launch a control panel to which we said, Yes, and from here, we can actually start our services individually. Now as I start them, I’ll give a brief explanation as to watch each service those Apache is our web service. And essentially, this Apache service is what allows us to serve up our PHP or PR, or there are are other languages that could be hosted on Apache, but Since we’re doing a PHP class, we will focus on PHP. And without this service running, our PHP code simply will not work. So we will be running queries to the database using PHP will be trying to display certain information and run certain maybe logic and business logic using PHP. But if our web server which is called Apache is not started, then all of this will be null and void. So we want to start Apache. Firstly, and you may be asked to allow access you can go ahead and do that. It’s a local server, so there should be little to no harm. Also, we should note that Apache server by default uses Port 80, which is the default HTTP port, also 443 which is the default SSL ports. Those can be configured because there might be a situation where you have conflicting web servers using Port 80 and Of course, once they are conflicting the neither will work. So you may need to change one to facilitate the other. So, since Apache is the only one we have that is active on this machine Port 80 is our default port. The next service that is very essential is the my SQL service. Now, my SQL is a database server. Apache is a web server, MySQL is a database server. Now my SQL needs to be enabled for us to facilitate offline storage of data. offline storage of data means that if a user for instance registers for our website, once they click that Submit button, that data that they entered in the registration form needs to be stored somewhere. And that is the purpose of my SQL in the whole LAMP stack. So my SQL needs to be started and we’ll just go ahead and click Start. And once again, allow access. And once it’s in the green, you know it hasn’t been started successfully and the default port for them My SQL is 3306. Now file Zilla is actually an FTP client which would allow us to upload our files to some hosting agent. So when we get to the point where we’re actually going to upload our website to cPanel or any other web host, then we will definitely need to use file Zilla but for now, we don’t need to start file Zilla and the Tomcat is also another web server. But it is usually used for Java and other languages. In this situation, we already have Apache so we don’t need Tomcat. Now having enabled or essential services, we can verify that the Apache web service is enabled by just going back to our browser and looking for local host. So local host is the default name for the machine you’re using. If you’ve never done networking, then then that would be new knowledge. So any machine you’re on is referred to as localhost. And if your web server is running typing localhost into your browser will grow to to the default page that would be served up by your Apache server. Now, in the case of XAMPP, because based on the flavor of the Apache implementation you’re using, you may get a different default page. In the case of XAMPP. This is the default page. And it’s mainly informational. You can read through it and see what it’s about. But essentially, it’s for informational purposes. And the next thing we want to verify is that our MySQL service is started properly. And to do that, we can go ahead and click on PHP myadmin. So you’ll see they have a bunch of links here. You can click on PHP info, I just middle click so open it in a new tab, and we can open PHP my admin. So PHP info shows you the PHP version That you’re working with which is 7.1 point three one. And it gives you some other information as to what is enable than what you may have access to, through this installation and implementation. If you scroll down, you will also see a few details on the Apache environment. And one of the very important parts would be where the folder paths are. So they show you that the document route is at C Zm. HD, Doc’s will go to that in a few. But just take note of this path, it means that any PHP application that you’re about to build needs to be hosted in this path in order for Apache to be able to serve it up and treat it with the regard it needs to be treated with. And if you go into and it’s a scroll through, you’ll see reference being made to different modules that are enabled. Some of them are important some of them you can look at at a later time and right No, we’ll just skip ahead and look at our my SQL implementation which is shown to us by the to PHP, my admin. Now PHP myadmin is a tool that was given to us along with our installation. And it is a web based my SQL administration tool, my SQL database administration tool. So you notice that it makes reference to a server at one to seven dot zero dot zero dot one. So this IP address actually resolves to localhost or the other way around localhost resolves to the IP address one to seven dot zero dot zero dot one. So that’s some good knowledge to have. If you ever want to browse to the web server on your machine that is the local machine that you’re using. Then you want to either say localhost, or you can directly type in the IP address one to seven dot zero dot zero dot one. Now, in the case of PHP myadmin, it’s actually showing us all of the databases that are created In our MySQL installation, so that’s just verifying that MySQL is running properly. And if I want to create a new database or make modifications to an existing one, this is where all of that magic can happen. Now point to note is that when you’re using PHP myadmin, sorry, if you’re using XAMPP, then you’ll see reference being made to my SQL sometimes and you see your friends being made to Maria dB. What happens is that it’s essentially the same server, it’s the same protocol, but one is a spinoff of the others. So MySQL was around and then Maria DB is a spinoff of MySQL based on the same technology, maybe just the differing philosophies. So you’ll see both of them being used and toted in the PHP development sphere WebSphere but essentially, the principles remain the same. They are both very popular databases used with PHP today. Build dynamic web applications. Now I’m going to do something. And I’m going to create my own page inside of the Apache web server. So I’m going to navigate to the path which was C, slash XAMPP. And there it is. And we see a number of folders including the PHP, the MySQL, and PHP myadmin. I would advise you not to trouble any of these unless you know exactly what you’re doing. But you don’t have to move or modify anything in this folder. But we want to target HD docks because this is our folder to put in what we want. No in our web server, we will see that we have a page called PHP index dot php. Now, this principle is pretty much widespread across every if most if not all web servers. The first page needs to be called index dot php. Some extension, it could be index dot HTML, in the case of Microsoft developments index dot SPX. But in this case, it’s index dot php, the factor means that if you have a web application developing, the first page that you want to be processed needs to be called index dot php. And that is why if you go to facebook.com, a page comes up even though you didn’t specify slash this page dot php. So that’s exactly how web servers work. If you want the first page to be rendered, it needs to be called index dot some extension and in this case, PHP. So what I’m going to do and this index dot PHP is what comes up when we navigate to localhost or other it has rotating rules that navigates us to the dashboard folder and if I take a look inside Have the dashboard folder, then you will see that in the dashboard folder, there’s also an index page. And this index page is actually an HTML file. So that does drives home the fact that the page just really needs to be called index the extension. Well, we can work on that. So in this case, we’re either working with index dot php, or index dot HTML. So taking from that example, having dashboard what I’m going to do is create a new folder, and I’m going to call it new site. And inside of new sites, I’m going to create a new file, just a text document and I’m going to call it index dot php. Now the purpose behind just creating this folder and this file is based on the principle of dashboard we saw when we navigated to localhost by itself and I’ll just do it again. It’s without rotates a local host slash dashboard. That’s probably because in our index dot php file here, there’s some logic that would rewrote it to another path. And that path being local host. Slash dashboard means that local host represents HD docs. And then the slash dashboard represents some folder inside of ht docs. And so that’s a principle that we will use going forward any site or application that we’re going to be building inside of our Apache server, we need to put it in a folder, and of course, the first name, the first file in that folder must be index. So we’re following that principle here where we create a new site. And inside new sites, we created some file called index dot php. And I’ll just quickly edit this file and I’ll just say hello world, the universally acceptable, it freeze and so the supposition is that If I say localhost slash new site, then I should see something rendered in my browser seeing hello world as I just depicted in my documents. Actually, I just realized that this is index dot php dot txt because it’s still a text document. So I’m just going to quickly edit the file extension. And just say Go to View and say, filename extension, so it’s displayed. So you see index dot php dot txt. I don’t want dot txt, I just want that PHP. So I just remove that. And now it will be a PHP file. I can ignore this warning because I know what I’m doing. And so Windows is telling us it’s a PHP file. So I’ll go ahead and navigate to localhost slash new site. And there we see hello world, like we just typed out in our docs. documents. So as you can tell, I have no real tools to edit. It’s very annoying here using PHP and using Notepad. And it can become quite complicated using Notepad. But for our best purposes, or at least for the purposes of this exercise we see here that we have accomplished and learned how to use our Apache server. And so in the next exercise or two, we will be installing relevant tools to help us expedite our development processes.