Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m

Next lesson playing in 5 seconds

Cancel
  • Overview
  • Transcript

8.1 Introduction to Server-Side Development

Back-end (server-side) development is very different from front-end development. In this lesson, you'll set up the tools needed to start writing PHP applications.

Related Links

8.1 Introduction to Server-Side Development

Server side development is very different from the front end. Now, when I say front end, that basically means anything that has to do with the browser. So HTML, CSS, and JavaScript, all of that type of stuff is front end development. And you can think of a web application in two parts, there is the user interface, which is the webpage. That's where we interact with these users, and then there's the server side, that's where all of the processing is done. So, let's go to tutsplus.com and we of course get to the tuts+ website. And what we see here is the user interface, now even though it's just text, there's some links here and there, and there's a form for searching. This is a user interface. Anytime that we send data to the server, which is with every time that we click on the link, or if we submit a search or anytime that we sign in. We are sending data to the server, so that the server can process that data, and give us what we need. So for example if we go to Sign in, and if we put in our username and our password and then we click on the Sign in button, that's going to send a request to the server with that information. The server is then going to try to authenticate us and if we are authenticated it's going to generate HTML for an authenticated user. That way we access the things only authenticated users can access, and all of that is controlled on the server. The client side or the front end doesn't really care about all that. That's just for displaying the information and allowing the user to interact with that information. So that is what we are going to be doing in this course, we're not going to be doing much within the browser itself. We are going to take data from the browser and process that and then return HTML. So, we are going to be generating HTML, that's exactly what happens at tuts+ and every other web application. The server side processes the data, generates the HTML, and then sends that back to the browser. So, because server side development is really dealing with a completely different environment as opposed to the browser, we're dealing more with things that are on the computer itself. So we need a few things, the first thing is an HTTP server. Now, there are many out there, but really there are only two that are used, and the first is called Apache. If you go to apache.org, this is the website for the Apache Software Foundation, and there are many Apache Projects. But the one that we are going to use in this course is the HTTP server. So, if you go to download, you can find the download for the HTTP server. Now, don't do this here, because we're actually going to use a tool that's going to make it easy to get started writing PHP. But I'm just pointing out the things that you would need on your computer. And as you gain experience, you might want to actually install Apache on your computer. Now, there are some operating systems that have Apache installed by default, like Mac OS does. However, it is an older version of the Apache. So it makes sense to download and installed the latest version. So that is one web server. Another is called IIS, this is made by Microsoft and it is free, but it only runs on Windows. And if you are on Windows and if you want to install IIS, all you have to do is go to your control panel, go to the programs and features, and then go to turn windows features on or off. And then one of these is going to be Internet Information Systems or services, just click on that, click on OK, and then you have IIS. Now Apache is the most used web server in the world. The vast majority of websites are running on Apache, and a lot of technologies run on Apache. We're going to be using PHP, but you could also use Ruby, Pearl, and just about anything else. IIS can run a lot of other things, but it's really more geared for asp.net, but you can also run PHP and other technologies. But we are going to use Apache because it is cross platform and it is pretty much the de facto standard when it comes to running PHP applications. So that's the first thing you need is a web server. The second thing after you get that installed and configured is PHP itself. We need the PHP runtime which is going to take our PHP code and actually execute it, and the website is php.net. And if you go to downloads, then you can download PHP for your operating system. Now, Windows users pretty much have it easy because there are binaries that will allow us to install PHP. There's also a zip file that we can unzip and it is just a lot easier to do on Windows than it is on other platforms. Because on other platforms you might have to compile PHP before you could actually use it. But don't download and install PHP. Once again we are going to use a tool that is going to make that easier. In fact, lets just go ahead and go that, if you do a search for MAMP, this is a tool that works with Mac OS and Windows. And you can see what it stands for, it stands for My Apache, which is the Apache HTTP web server, MySQL, which is a database and then PHP. Now, a database is something that you would typically want in your application, because if you are writing a full blown web application, you need some way to store data. And MySQL is what we call a relational database. Whenever you hear about databases, they are typically relational databases that means that the data in one table is related to the data in another table. Now, that's not always the case but there's a relationship between different tables and MySQL is a free database engine. Microsoft has one, you can find free databases, just but anyway. But there is also non-rational databases they are called document databases MongoDB is one of those. And PHP is very flexible, you can use a variety of database engines with PHP, MySQL is typically the database that we use with PHP applications. So with this MAMP, you get the Apache web server, you get MySQL, and you get PHP all in one. You don't have to download each thing individually and configure them, it's just all done for you. And there's two versions, there is MAMP, and then there's MAMP Pro. Now MAMP is just free, and it gives us the basic things that we need, and that is what we are going to use. So, if you are on OS 10 or Windows, then download MAMP, just choose your operating system and click on Download. The installation is very, very straightforward. In fact, the only question that I really had to answer was whether or not I wanted to include MAMP Pro. And I unchecked that, I did not want MAMP Pro, I just wanted the default MAMP. But you can see the components that comes with MAMP, we have Apache 2, we have MySQL 5. But, we're not going to do anything with MySQL, but we will have it installed. We also have PHP 5 and 7, open SSL, there's a lot of things that come with MAMP. Now, if you are on Linux, then there are some other tools that might be useful, if you do a search for a LAMP, then you could find some useful information. If you do a search for LAMP PHP then that will avoid all of the real light LAMPs. But LAMP stands for Linux, Apache, MySQL, and PHP. There's also WAMP which is Windows, Apache, MySQL, and PHP. But LAMP is for Linux, just do a search and somewhere in here you'll find something that will make it easier to get started with those technologies on Linux. So after you have MAMP installed, then all you have to do is just restart your computer and start it up, and I'm going to do that. And one of the really cool things about MAMP is that, we don't have to always have it running. That's one of the things that if you install Apache on your computer, it is always running unless if you turn it off. That's why some developers will actually have a completely separate box for their development server. They will install Apache, MySQL, or whatever database engine that they need to in this other computer, so that their main computer isn't running all these things all of the time. But MAMP makes it easy to turn it on and turn it off. If you go to preferences, then you can have the choice of to start the servers when starting MAMP, you can also stop the servers when quitting the MAMP and there's a few other things here. Now in PHP, we're going to be using the Version 7.0, that's actually not the latest version I believe it's 7.0.2, but 7.0 is going to be fine. There's also some other options that we could set. Now this document route is very important, this is where all of our documents are going to exist. So in the next lesson whenever we create our first PHP page, we're going to do so inside of this htdocs folder. But that's basically it. Once you get MAMP installed and it's running, you can see that the Apache server is running, the MySQL server is running. If you click on Open start page that's going to fire up your default browser. It's going to localhost/mamp and this is what we have, this is a website running on our computer. If you click on phpInfo, this is going to give us all of the information about the PHP installation. And there's really nothing to note there, at least for our purposes, as you get more acquainted with PHP, then some of this information is very useful. So that is what we are going to use in this course, MAMP, makes getting started with PHP, Apache, MySQL very easy. In the next lesson we are going to start writing our first PHP page.

Back to the top
View on GitHub