Site Moved

This site has been moved to a new location - Bin-Blog. All new post will appear at the new location.

Bin-Blog

Problems in Web Developing using Linux

In the last post of this series, I talked about the main browsers that can be used in Linux. This brings us to one of the biggest problems associated with web development in Linux - IE. Internet Explorer. If you want to make it sound really evil, use the full name - Microsoft Internet Explorer. *Shudder*

IE is the curse that comes with web developing. You cannot ignore it - after all, it is the browser used by 102.7% of your visitors. Most non-trivial CSS or JavaScript will be rendered differently in IE. Testing in IE is unavoidable. This brings us to our problem - you cannot have IE in Linux. This gives us three options to test our site in IE...

  • Use another computer with Windows in it to test the site in IE.
  • Create a Duel booting configuration with some version of Windows along with your Linux OS.
  • Install IE in Linux using Wine.

The first option needs no explaining - just another computer. This is the most expensive option - but useable.

The second option - creating a duel booting setup - is the one I use. I have Windows XP and Fedora Core 3 on my system. I have XP just for the purpose of test my pages in IE(and playing games). Setting up a duel boot configuration in your computer will not be hard - most Linux distributions have a boot manager capable of multiple OSes(GRUB, LILO). I use a XOSL as my boot loader. I will not be getting into explaining about duel booting - it is a big topic and there are many good Howtos about this topic on the web.

Let us assume that we have a system with Windows and Linux. To test your site in IE we have two options...

  • Make your site and upload the pages to your online site. Then just look at the pages in IE after booting into Windows.
  • Configure the Web Server and MySQL server in Windows to use the same files used by the Linux Servers.

Now, I consider myself as a fairly brave person. But I don't have the kind of courage required to browse the web using a Windows system. So I am abandoning the first option. The second is much more fun.

I am going to assume that you have keeping all your web documents in the Linux filesystem. The Web site will be stored at, say, '/var/www/html/' and the MySQL database will be stored at '/var/lib/mysql'. The first thing we need is a program to access the linux filesystem from Windows. I use and recommend IFS Drives.

IFS Drives will enable you to map various linux partitions to Windows Drive Letters. For example the '/var/home/' could be 'G:' drive. This drive will appear in 'My Computer'. The software is fairly stable(although I have seen some bugs.)

In my system I have mapped the root directory of Linux - '/' - to the letter 'H:'. So, if I access 'H:/var/www/html/', I get the apache's document root.

Now we must install all the servers we will need. I do must of my web development using PHP/MySQL on Apache. If you need other languages like Perl, Python or Ruby, you have to install them too. For the sake of convenience I am going to assume that you are using Apache, PHP and MySQL. First we will configure Apache to use the linux document root. Open the 'httpd.conf' file in notepad. This file contains all the configuration for the Apache server. It is usually found in the 'conf' folder in the folder where Apache was installed(eg. 'C:/Apache/conf/httpd.conf').

Once you have opened the file, search and replace the following lines...

DocumentRoot "C:/some/location"

Replace it to the location of your document root. For example

DocumentRoot "H:/var/www/html"

Now find this line and do the same for these lines too.

<Directory "C:/some/location">

to

<Directory "H:/var/www/html">

There could be two instance of these line - make sure you change them both.

Now we need to change the location where the MySQL server stores the database. Open the configuration file for MySQL(usually 'C:/Windows/my.ini'). Find the line...

datadir=C:/some/location

and replace it too...

datadir=H:/var/lib/mysql

I don't have to tell you that you will have to change the folders to whatever it is in your system. If you have done all things correctly and if Murphy is not up to his old tricks, you can open up the location 'http://localhost/' in IE and see your site - in Windows.

Good luck. More on the same topic in the next post.

Filed Under...

0 Comments: