Join James Williamson for an in-depth discussion in this video Server-side scripting, part of Web Development Foundations: Web Technologies.
In our last chapter, we discussed front-end technology. In this one, we're gonna change our focus to exploring what happens on the server, and the types of technologies that are used to create dynamic websites. Any scripting or programming that runs on a web server is referred to as server-side scripting. This could be anything from processing a form, managing an online purchase, registering a new user, or even something like booking a hotel room. As web sites have matured, technologies that surround server-side scripting have matured as well. In the early days of the web, most server side scripting was done with what we call CGI Scripts. CGI stands for Common Gateway Interface, and it was created as a way to run scripts from programming languages like C+ or Perl on websites. Since then, a multitude of programming languages and frameworks, like PHP, Java, .NET, Cold Fusion and others have given developers a wider array of tools to choose from when they're creating dynamic sites. Although each language is slightly different, the process for utilizing server side scripting on a web page is pretty consistent. If a web page containing server side scripting is requested from a server, the web server first processes the script before the page is served to the browser. Processing the script could involve pulling information from a database, making simple calculations, or choosing which pieces of content to display on the page. Once the script has been processed, the resulting content is then returned to the browser, an then it's rendered. This process can occur from either a simple page request, through something like a user, filling out a form, or from interacting with a specific widget. Since the scripts run on the web server prior to serving the content, the scripts themselves are hidden from the end user. Now this adds a layer of security for both the data and the source code itself. There are, of course, some downsides to using server side scripting. Since the processing must be done on the server, it places the burden of running the application on the web server itself rather than the client machine. For larger applications, or sites with a lot of page requests, this can slow down the site, or force the site to upgrade to larger or even multiple servers to handle the load. The flow of dynamic pages can be frustrating for end users as well. Because the server must process the scripts, there's usually a page refresh required to display new content. This is largely the reason that client-side scripting has gained in popularity as well as the development of techniques that run server-side scripts without requiring page refreshes. To be honest, the terms client-side scripting and server-side scripting are becoming rather nebulous. Developers have become very adept at using Java Script to blend the two methods together into a seamless user experience.
- Working with web clients and servers
- Exploring HTTP
- How browsers work
- Structuring HTML
- Controlling presentation with CSS
- Dealing with data
- Working with a content management system (like WordPress)
- Using cloud services