Hello world in php

 

Hello all,

Before going further I hope you have xampp installed. If not, please install xampp (or wampp or easyphp).

So please start your xampp. Go to xampp control panel and start apache and mysql. (xampp may be in your start menu, your notification bar, or in desktop as a shortcut ).

Fig1: xampp control panel after starting apache2 and mysql.

Your control panel should be viewed as the above picture. If not, send me the error it is showing.

Now go to your local directory(web root , means htdocs or wwwroot folder ), if you are using xampp, it should be htdocs folder.

Now it is a good practice to create a folder in htdocs. May be name the folder “projects”. Now create another folder in “projects” named “tutorials”. Now under that, create another folder, name it “tutorial1”. So your folder structure will be “projects/tutorials/tutorial1”. If you create that, now it is time for the code.

Lets see, you can make php codes with notepad, or notepad++ , or you can use ides like netbeans , eclipse or aptana (There are a lot of others out in the internet, so choose your weapon!)

Now make a file named “index.php”. (index.html or index.php will be your entry point for your web application, if it is not overwritten.)

Ok, so open the file using notepad or notepad++. I will use notepad++ in here. Write the following lines :-

<?php

echo “hello world”;

?>

Save the file , don’t forget that.


Fig 2. The notepad++ with the code

Now open your web browser (I suggest to use mozila firefox) write in the address bar “localhost/projects/tutorials/tutorial1”. I hope you are seeing just like this screen shot :-

 

So, welcome to the web development. It is just the beginning.

We will go with some more work later.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s