This is an archived tutorial from the kirupa.com legacy collection. It covers software that may no longer be available, but it is kept online because the ideas still hold up.
PHP is a great language that web developers such as yourself should know. PHP, which stands for PHP: Hypertext Preprocessor, is very useful for adding simple interactivity or communicating with databases. Best of all, PHP is not very complicated to learn.
Unlike other languages, PHP does not require rigorous training and a long time of practice before you can create anything useful or publically displayable. In fact, by the end of this tutorial, you will have created a web page that displays some text from a PHP script!
What Do I Need to use PHP?
To display PHP, you will need to have a web server that is
properly configured to display PHP. Most web
hosts such as
mediatemple (which hosts this site) have PHP enabled by
default, so you should be set to go. To test if your server
is capable of running PHP scripts, try the method outlined
in the following tutorial:
http://www.kirupa.com/web/testphp.htm
If you do not have PHP installed, you should contact your web host and request them to enable or install PHP for you. If you are planning on setting up your own web server, there are a lot of great resources on the net that will explain how to do that.
To create PHP code, all you need is any program that allows you to enter code without adding extraneous formatting. You can use any program such as Notepad or even the code-views of FrontPage and Dreamweaver. For this tutorial, I will be using Notepad for simplicity reasons. Once you become familiarized with the PHP language, feel free to use any program that allows you to write PHP scripts.
So, let's get started with a very basic PHP example that you will create!
Here is how:
<html> <body> <?php print("The developer in Spain codes gently in the rain."); ?> </body> </html>
Congratulations! You have created a working PHP example. Now that we have crossed that milestone, let's learn why the above code worked.
The following section explains why the code works the way it does.
<?php
print("The developer in Spain codes gently in the rain.");
?>
While PHP works with HTML, you need to find a
way to differentiate PHP code from the HTML code. You cannot
place PHP code randomly inside another HTML document. The
solution is to place all PHP tags between
<?php
and
?>
tags as shown above.
<?php
print("The developer in Spain codes gently in the rain.");
?>
You use the print command to display something in your browser. In our example, all you are doing is simply displaying the sentence to our browser.
I hope the information helped. If you have any questions or comments, please don't hesitate to post them on the kirupa.com Forums. Just post your question and I, or our friendly forum helpers, will help answer it.
The following is a list of related tutorial and help resources that you may find useful:
|
|
How to use the Forums |
|
|
New, Upcoming, and In-Progress Tutorials |
|
|
How to Help out kirupa.com |
|
|
Writing Tutorials |
| Cheers! | |
|
|
Kirupa Chinnathambi kirupaBlog |
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence slop, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.
Your support keeps this site going! 😇

:: Copyright KIRUPA 2026 //--