Part 14 - What are server-side languages?Written by Eric Muss-Barnes, 21 December 2018
Now that you have a good grasp of some of the basics of building websites, we can get a little more advanced.
There are two new terms and concepts I need to express:
The "client" is any device the user is accessing the Internet with - a desktop computer, a tablet, a smartphone, a laptop, whatever.
The "server" is a reference to the webserver that contains the webpages.
Up until now, all the things I have taught you are "client-side" technologies. In other words, the code is being rendered and displayed on the users computer, in their browser, on the "client-side" of things.
Server-side technologies are a way of programming websites so the web server actually does a little bit of processing and compiling on your code, before it turns the code into plain HTML, and sends it to the browsers.
One of the most simplistic examples I can give is the "years of experience" I cite on this website. When I mention in various articles that I have been programming websites for 23 years, I do not want to manually update the number "23" every year. So, I use a bit of server-side code to do some math. I calculate the current year, minus the year I started developing. The server-side language I use is called "PHP" which is an abbreviation for Hypertext Preprocessor... I know. I know. Another abbreviation that makes no sense. Why isn't it called HTP? No idea. It's called PHP. Although the name is weird, it does do what it says - it performs "preprocessing" on regular HTML hypertext. Here is an example of the PHP code I use to change the year:
PART 14 - LESSON A - SIMPLE PHP YEAR CALCULATOR
That above block of code appears anywhere I want "23" to appear on the page. Obviously, the "1998" is the year I began developing professionally. So, you could use a similar block of code on your project. If you build a website for a professional plumber who started in 2005, then you would change the 1998 to 2005 and it would do the same thing - give you the number of 16 years.
You may have also noticed the URL of pages on this site all have filenames ending in .php instead of .html.
That lets you know this entire website is built on PHP.
PHP is not the only server-side language. There are many others, such as:
As I said earlier, the PHP is processed on the server (server-side) and sent to the browser as HTML.
Why is this so important?
Because it means you are getting actual HTML on the page in your browser. HTML that can be indexed and recorded by search-engine spiders.
One of the most important things to understand about server-side languages is that they are actual programs/applications running on the server. Therefore, it's not very easy to learn these languages on your desktop computer. In fact, you only have 2 options to learn these languages:
1.) You need access to a server or webhost configured to use that language.
2.) Install server software on your own local desktop computer, and run the commands from your personal computer as you work on the code.
Those are the only ways to do it. Some of the newer and more "trendy" server-side languages are not widely supported, so it can be difficult to find a web hosting provider who will give you shared server space which uses that language.
And, setting up a server on your local computer is something that can obviously be kind of an arduous task.
PHP has a great program called "WampServer" which will let you run PHP code on a Windows computer. But, if you are new to computers, it can be kind of difficult to get WampServer configured properly. I'll give you a link to WampServer at the end of this article, if you want to give it a shot.
This is why, I highly recommend learning server-side languages on the actual web server you will be using to host your website. That is the easiest way. Using that approach, you can be 100% certain all the code is going to work and run, because you are learning it in the exact same environment you plan on launching your website.
Back in 1998, I began my web development career using ASP, which is an abbreviation for "Active Server Pages". Do not confuse ASP with ASP.NET because they are very different things. Both ASP and ASP.NET were developed by Microsoft, and while ASP.NET remains very popular, ASP is not really supported anymore, so no one uses ASP. One thing you need to accept as a computer developer - any language you learn at the beginning of your career is likely to be replaced and outdated by the end of your career. This is why you need to be careful of 2 important things:
1.) Always strive to improve your education and learn something new.
2.) Do your best to be savvy and perceptive of "trendy" technology, learn useful new technologies, and don't waste your time learning things that will quickly fall out of fashion.
The first one is easy.
The second one is hard.
Now that you have a basic understanding of the power of server-side languages, let's explore some of the basics of PHP in the next article. Once you learn PHP you will be fast on your way to building some far more robust websites. The more you know, the better. The more you can build, the better. The more knowledge you have, the better.
And remember, kids, the world owes you nothing... until you create things of value.
client sideWhen website code is being rendered and displayed on the users computer, in their browser, on the "client-side" of the Internet.
server sideServer-side technologies are a way of programming the websites so the server actually does a little bit of work and compiling on your code, before it sends it to the browsers.