Web Development, Better Done On GNU/Linux

RSS Feed - Comments
Author: Jacob Barkdull on Friday, February 18 2011

I often tell people that setup, configuration, writing, scripting, and other general development of any website is better done on the same web server, or at least the same operating system that is installed on the web server, that the site is going to be hosted and ran on, rather than developed elsewhere and simply dropped in place later. It doesn't matter whether you're using Apache or Windows Server, GNU/Linux or Windows.

I say this because I often see people who write a large amount of code and/or spend hours writing the HTML, CSS, and JavaScript for the website's design in Windows, only to find that the HTML source doesn't look right in their text editor on their GNU/Linux server. This happens because Unix and Unix-like operating systems, like GNU/Linux and Mac OS, only place a "Line Feed" at the end of each line, where as in Windows a "Line Feed" and a "Carriage Return" are placed at the end of each line. So on Windows, files missing the expected "Carriage Return" read as one long line, on GNU/Linux, files with an unexpected "Carriage Return" read with double spacing, which doesn't make compilers, interpreters, nor text editors very happy.

That problem is actually one I hear a lot, and one I had myself before switching entirely to GNU/Linux, but the problem is bigger than just extra line breaks. Because the file originated from a Windows computer and the extra "Carriage Return" displays as "^M" at the end of each line or as a second line break, I often hear that PHP code won't execute or executes very slowly, that their software for web development on the server won't open the files or opens them as corrupt gibberish.

Sometimes they don't even have web development software on the server at all.

The problem actually exists both ways, too. I often hear that after encountering and resolving many problems, they then find that they're having whole new problems when they attempt to work with the files again on Windows after making changes to them on their GNU/Linux server. They see some opposite behavior and yet similar problems, like files display with only a single -- very long -- line, and web development applications either refuse to open them, open them corrupted, and/or certainly save them in the same manner that caused them so much trouble the first time around.

All this can be avoided by simply using the same web server when developing the website infrastructure, using the same operating system that is installed on the web server, or using a capable text editor, though the problem can still persist if some programs handle the foreign newlines properly while others do not. Compilers and interpreters may fail with obscure syntax errors even though the source file looks correct when displayed on the console or in a text editor.

Many people like GNU/Linux for developing websites and software, and how could I blame them. GNU/Linux has some of the best compilers, interpreters, debuggers, and professional software development suites around. Almost every text editor supports syntax highlighting and autocomplete for multiple languages, regular expression, and search and replace. While the more professional applications also have function calltips, IME support, integration with major source code control systems, built-in DOM viewer and editor, built-in HTTP inspector, built-in multi-language debugger, built-in web browser, and so much more!

Even little things like URLs make more sense on GNU/Linux because they are consistent with the operating system location paths, for example "/var/www/articles/bash.css" and http://www.tildehash.com/articles/bash.css both are written with forward slashes, you don't end up with a situation where an entire website's HTML, CSS, JavaScript, and PHP files all have incorrect paths like "C:\\tildehash\articles\bash.css".

And let's not forget the easy one-line "apt-get" command for installing and updating of an entire free web server application suite and it's many impressive extending components such as PHP5-FFmpeg, GD 2, etc.

In conclusion, if you're planning on developing a website on GNU/Linux, make sure to use a Unix or Unix-like operating system on your server. And if you're planning on developing a website on Windows for use on a GNU/Linux web server, stop right now and switch over to GNU/Linux, or prepare for a confusing mess.
What Is This Place?
TildeHash is a website for Tech articles revolving around Free Software and Unix/Unix-like operating systems, written by Jacob Barkdull and various contributors, respectively. Meaning, Free Software (or Open Source); and GNU/Linux (or simply Linux), BSD, OpenSolaris, or Haiku; respectively. The main goal of TildeHash is to be different -- the name alone is a little different (explanation here) -- but to do it in a useful way.

TildeHash is about discussing Free Software topics that are beneficial to our community, topics that are largely not discussed nor shown. "Free Software" is also often called "Open Source Software". In practice the requirements are identical, although because the term "open" doesn't call to mind freedom, it misses the point.

List of Articles >>