- Forums
- PHP
- Simple Php Script Hello World
This Short Simple Tutorial Will Show You How To Make An Easy And Simple Hello World Script In Php [2047], Last Updated: Mon Jun 24, 2024
Webune Support
Sun Oct 11, 2009
0 Comments
457 Visits
hi, welcome to Webune Support Forums. Today we are going to teach you the basics of PHP.
we are going to make a simple easy hello world script written in PHP
you must have PHP hosting plan for this to work.
to write this tutorial, i am using a windows xp computer. so windows xp comes with notepad. notepad is a ascii text editor. you can use your favorite. but since i am using windows xp, i will use notepad.
so open a blank notepad
the first line we are going to tell the server that we are starting PHP so we use this tag:
Line 1: <?php
you should aways start with <?php
you might see some scripts that only use <? but thats not a good idea because you might run into problems if you try to run the script on another server which is configured to ignore <? and only accepts <?php
the next line we are going to use echo
echo is like print, PHP also has the print() function you can use, but to keep things simple we are going to use echo
Line 2: echo 'Hello World';
[NOTE: you should always end your line with ;]
on line three, which is our last line, we are going to close our PHP instructions to the server by using this:
Line 3: ?>
ok, if you have done everything good so far, you should have three lines in your notepad and it should look like this:
<?php
echo 'Hello World';
?>
now save the file as "webune-hello.php"
[NOTE: be sure to include the quotes when saving the file in windows, if you dont include the quotes, it might save the file as: webune-hello.php.txt and we dont need the .txt at the end]
now upload webune-hello.php to your PHP website and open it in your browser with your url.... example:
http://www.example.com/webune-hello.php
you should see only two words: Hello World
if you dont see anything, then you dont have PHP in your website. Signup with us for PHP Web Hosting - all you need is a TLD Domain.