Sunday, October 19, 2008

Setting up the web server

This is a follow up to my last entry and specifically relates to lighttpd , MySql and PHP5.

Prior to my getting my Eee PC I have mostly worked with Slackware for setting up web servers. When you stay with one distribution for some time you get to know where everything is installed. When you try to move away from this you sometimes get a little lost. Oh well, that is part of life.

So I have been told the most successful way to install on the Eee PC is with apt-get. This is a method I have not had much to do with without someone beside me who was experienced. I don't consider that I have become very good at this method at this time, but after much reading of websites and a lot of experimenting I have managed to get my desired result.

When I tried to install apache on the Eee PC, apt-get informed me that it was not available for my system but that lighttpd was its replacement. I nervously accepted this and went ahead with the install. Not wanting this package to run everytime I started the computer, I put a script in /usr/local/bin to start it instead of editing the rc scripts in /etc.

When I first tried to view a .html page I only got a blank screen. Searching the web with the error message I found in the log file I discovered that I could edit the config file and add a command to use writev().

I installed the MySql on my sata drive and used symlink to mount it in the /usr/local directory. I used my previous experience with MySql to initialize it and set my root password.

I used apt-get to install the PHP5 components and edited the lighttpd config file to call php5-cgi for my access to MySql.

I copied a bunch of files from my existing web server into my user home directory and set my public_html for access by the web server. Then I ran my web browser and called on my home page. All seemed good for the first screen. Then I called my php login script to access MySql. Ooops. Screen goes blank and the system hangs.

Several hours pass with much accessing of the internet looking for someone who has solved this problem. What I find is that there may be some problem with my MySql port. It seems that php5 looks at /etc/services to get the port by default. After playing with some of the scripts in the MySql collection I found one that showed the port I was using. This did not match the one given in /etc/services. I edited the php.ini file and told it which port I was actually using and Bingo, everything works perfectly.

Now I have this tiny computer I can take on the train and it has all my MySql data. What a thrill.