www.Hasitha.info

About my personal experience with various things related to web mastering

Archive for the ‘Web Master Tips and Tricks’ Category

Since My SQL has become the top data base server its good to learn how to configure it locally in your personal PC. That way you can test your data base driven web applications before uploading them to web sever. It could save you from lot of real big messes which could happen if you code didn’t work as you want. Installing My SQL 5 in Windows XP is not a hard thing. Also its lot easy than pervious  versions. You just have to follow steps and it would be installed no time.

First you have to install Apache and php in your pc before installing My Sql 5. If you haven’t done that yet, Now its time to do it.


Installing and configuring Apache web server in Windows XP

Installing php 5 in Windows XP

First, Goto www.mysql.com and download the ” MySQL 5.0 Community Server “. Unzip it and click on .exe file. and follow steps bellow.

Installing MYSQL 5 in windows XP

Installing MYSQL 5 in windows XP

————————————————————————

Installing MYSQL 5 in windows XP

Installing MYSQL 5 in windows XP

————————————————————————

Installing MYSQL 5 in windows XP

Installing MYSQL 5 in windows XP

————————————————————————

Installing MYSQL 5 in windows XP

Installing MYSQL 5 in windows XP

————————————————————————

mysql-05 Installing and configaring My SQL 5 with PHP

————————————————————————

mysql-06 Installing and configaring My SQL 5 with PHP

————————————————————————

mysql-07 Installing and configaring My SQL 5 with PHP

————————————————————————

mysql-08 Installing and configaring My SQL 5 with PHP

————————————————————————

mysql-09 Installing and configaring My SQL 5 with PHP

————————————————————————

mysql-10 Installing and configaring My SQL 5 with PHP

————————————————————————

mysql-11 Installing and configaring My SQL 5 with PHP

————————————————————————

mysql-12 Installing and configaring My SQL 5 with PHP

————————————————————————

mysql-13 Installing and configaring My SQL 5 with PHP

————————————————————————

mysql-14 Installing and configaring My SQL 5 with PHP

————————————————————————

mysql-15-a Installing and configaring My SQL 5 with PHP

————————————————————————
Setup a root user/password for database server. You can just use “root” for user and same for password too. It won’t matter since you would only use it in your local Machine.

mysql-16 Installing and configaring My SQL 5 with PHP

————————————————————————

mysql-17 Installing and configaring My SQL 5 with PHP

————————————————————————

That’s all. if you had done all correctly last screen will be link this.

mysql-18 Installing and configaring My SQL 5 with PHP

————————————————————————

Now you have to configure php with MySQL. For that open the php.ini file. ( C:\WINDOWS\php.ini ). and remove the ” ; ” which has in front of “extension=php_mysql.dll” as the screen print shown below. now restart Apcahe server.

mysql-19 Installing and configaring My SQL 5 with PHP

————————————————————————

To Manege data bases we use phpMyAdmin. first download the latest version from www.phpmyadmin.net and unzip it. Then rename the folder as “myadmin”. Copy this folder into your “web” folder. ( C:\web\ ).

mysql-20 Installing and configaring My SQL 5 with PHP

————————————————————————

Now open your web browser ( IE or Firefox ) and type this ” http://127.0.0.1/myadmin/ “. See whether you get screen below. If you get the message bellow , it means everything is all right and you only have to configure MySql user name and password with MyAdmin.

mysql-21 Installing and configaring My SQL 5 with PHP

————————————————————————

To change password to yours goto “libraries” folder in MYAdmin folder and open the file called ” config.default.php “. ( C:\web\myadmin\libraries\ ). There you have to find the place to insert root pssword. Use Find option to find ” ['Servers'][$i]['password'] =” “. and insert the password into space between quotation marks as screen shot shows.

mysql-22 Installing and configaring My SQL 5 with PHP

————————————————————————

Now goback to web browser and refresh the page when you got that message. Now page should look like this.

mysql-23 Installing and configaring My SQL 5 with PHP

————————————————————————

Thats all. Sorry You might feel some steps are too basic and really unnecessary but I want to make sure all steps covered so even a newbie can get installed it without a problem.

Installing PHP 5 in windows XP

Installing PHP 5 in Windows XP is not hard at all. There are so many ways to do it but here we are going to do it in pretty easy way. You will able to setup PHP 5 in your Computer within 10 minutes. First let’s see what you need.
01. A computer which runs Windows XP
02. Apache Web Server ( If you don’t have it installed already here’s a guide )
03. PHP 5.2.6 zip package ( Windows binary )
That’s all you need! You can get configured PHP with Apache without any pre-knowledge with this tutorial. To make things easy All steps have screen prints, So you can understand things clearly.

Now go to php.ini file again and tell it where it can find its extension folder. Use the Find Next option to find “extension_dir” and change the pat to “c:\php\ext”

12 Installing PHP 5 in windows XP
Download PHP zip package from www.php.net . Go to the site and click on link called “Downloads“. Click on “ PHP 5.2.6 zip package ” link under “Windows Binaries”. Download It and unzip the content.

00 Installing PHP 5 in windows XP

Now copy the folder “php-5-26-win32” into C drive of your hard drive. Then rename it as “php”.

011 Installing PHP 5 in windows XP

02 Installing PHP 5 in windows XP

Now you have to make a virtual host folder to put your php files and web pages. Make a folder named “web” in your C drive. You can see the folder “web” in above screen shot.

Now go to the Apache folder (C:\apache) and go to the sub folder “conf”. Open the file called “conf” in notepad. Click on top of the page then go to edit menu and click “Find Next”. Insert word “DocumentRoot”. And click on “Find Next” button. You will find the word in page highlighted. There change the path to C:/web as screen shop shows (below)

04 Installing PHP 5 in windows XP

Now restart Apache (Click on Apache Monitor icon on system tray and select restart). Go to your favorite web browser (Firefox, Opera or whatever) Write http://127.0.0.1/ on address bar and click enter. If you see a page then your virtual folder is working! (I forgot to tell make an html page and name it has index.html and put it in folder called “web” in your C drive). If everything ok you will see the content of that html page on your browser.

05 Installing PHP 5 in windows XP

Now in PHP folder find the file called “php.ini-dist”, move it to the Windows folder and rename it as “php.ini”.

06 Installing PHP 5 in windows XP

07 Installing PHP 5 in windows XP

Now you have to tell PHP how to find the vertual folder. Open the php.ini file in notePad and find “doc_root”(you can use the Find Next option in Note pad to find it). Edit it as this “ doc_root=”C:/web” ”.

08 Installing PHP 5 in windows XP

Now go to Apache folder then to conf folder and open httpd.conf file again. There copy and paste 2 lines where screen shot shows.

LoadModule php5_module “c:/php/php5apache2_2.dll”
AddType application/x-httpd-php .php

09 Installing PHP 5 in windows XP

Now you have to add .php extension to Apache server. In same file ( httpd.conf ), use Find Next option to locate “DirectoryIndex” directive. There add “ index.php “ after “ index.html” as shown below.

11 Installing PHP 5 in windows XP

Now go to php.ini file again and tell it where it can find its extension folder. Use the Find Next option to find “extension_dir” and change the pat to “c:\php\ext”

121 Installing PHP 5 in windows XP

Now restart Apache! And if it restarted without problem then you have PHP installed and configured in your computer. Sometimes you might need to restart the computer before things start work. If Apache is giving you an error message then follow all steps again and see if anything has gone wrong.
Last step. If Apache is working fine now open black note Pad page and save it as info.php in your virtual host folder (C:\web) make sure you select Save as type as “all” when you save the file. Now on it write this and save again.

Now open your web browser and type http://127.0.0.1/info.php. If you can see the page below then your installation is successful!

13 Installing PHP 5 in windows XP

If you want to learn PHP or if you are a PHP programmer then running Apache server in your work PC makes your life lot easy. Installing Apache web server in a windows XP machine is not hard. Here I’m explaining how to install Apache on windows XP step by step with screen prints to understand things better. If you are a experienced php developer you might find some steps are too easy and unnecessary but I’m mainly targeting this for starters. I know how hard it was when it tried to do it by my self without taking any help. It was still hard even trying to follow online tutorials because most authors had skiped some steps and some had forgotten some important steps. So lets do it step by step and Install/configure Apache Web server in XP.

01. Download apache http server from www.apache.org ( version 2.2.9 win32 windows installer ). Download the one called ” Win32 Binary without crypto (no mod_ssl) (MSI Installer) “.

02. Run the installer file.

how to install apache in xp

03. Follow Steps shown in Screen prints

how to install apache in xp

apache-03-300x224 Installing and Configuring Apache Server on Windows XP

apache-04-300x229 Installing and Configuring Apache Server on Windows XP

apache-05-300x235 Installing and Configuring Apache Server on Windows XP

apache-06-300x237 Installing and Configuring Apache Server on Windows XP

apache-07-300x280 Installing and Configuring Apache Server on Windows XP

apache-08-300x234 Installing and Configuring Apache Server on Windows XP

apache-09-300x230 Installing and Configuring Apache Server on Windows XP

apache-10-300x230 Installing and Configuring Apache Server on Windows XP

If everything has gone well then you will see Apache Monitor Button in your system tray with a green arrow in middle of it. Like in the screen shot below.

apache-11 Installing and Configuring Apache Server on Windows XP

To make sure web server is working well. Goto your web browser and type http://localhost/ or http://127.0.0.1. You will see apache default page if you have installed it correctly !

Well if you want to put your web pages then goto the folder called “htdocs” inside Apache folder. But still you can’t use php files since you haven’t installed and configured php yet !

Most of the time we want all search engines to spider our websites and index all pages. Because it is very important to search engine optimization. But There are time when we doesn’t want search engines to crowl our web sites. Times like if the site is still developing or you have made a diplicate of your original site for testing purposes you don’t want search engines to spider these web sites. The best way to stop it is using robot.txt file. The reason is, if you allow search engines to crawl these duplicate sites or pages, would be considered duplicate content by Google and other search engines

This is how to stop all search engines spidering your site. Just make a text file called robot and put these lines ;

User-agent: *
Disallow: /

How to tells all crawlers not to enter into some directories of a website

User-agent: *
Disallow: /cgi-bin/
Disallow: /images/
Disallow: /tmp/
Disallow: /test/

How to tell a specific crawler not to enter one specific directory

User-agent: Googlebot
Disallow: /DirectoryName/

How to tell all crawlers not to enter one specific file

User-agent: *
Disallow: /directory/file.html

I think that’s enough for you to get a pretty good idea about how to use robot.txt file. It can be very useful in times. Specially having a robots.txt file is much preferred over ‘nofollow’ links.