How to Create Your Website With PHP

by Jennifer M. Graham

PHP is a server-side programming language used to create web pages that are more interactive than their HTML counterparts. PHP also optimizes the speed of web pages since processing occurs on the server and not on the side of the end user. To create a website with PHP, you need a basic understanding of the language plus some knowledge of web development. There are websites and books where you can learn the proper syntax for PHP. Because PHP is an open source language, it is less expensive to use than its counterparts. .

1

First, you need to obtain a web hosting service that carries PHP. PHP version 5 is the latest version but PHP version 3 is sufficient if you are willing to do some extra programming steps.

2

After you open an account, choose a domain name for your site. The domain name will be the address that points to your site that everyone sees. You can usually obtain one from your web host, but other sites that sell domain names can be found.

3

While logged in to your web host, locate the folder that contains the web host’s PHP files (usually placed in folder labeled CGI for Common Gateway Interface). The PHP file you create must have access to these files.

4

Create a file with a .php extension using a word processing application or a text editor. Begin the section that will contain the PHP code with “<?” and close it with “?>”.

5

Fill in the space between the beginning and closing characters with PHP code. The following example will produce the current date: <?php $today = date(\"D, M j, Y\") GO print \"$today\" GO ?>

6

When creating a large site, choose a content management system (CMS) to manage all the files for your site. Find a CMS that works with PHP. The CMS will help administration of the site, aid in keeping track of content and ease any future changes to the content.

7

After you set up your PHP files on the CMS, you should download them to your computer and then upload them via a File Transfer Protocol (FTP) to your web host account. This can be accomplished with free FTP software, like Filezilla or FireFTP.

8

After your files are uploaded to your site, install your CMS. Your domain name is key to installation and typing it into the web browser usually will launch an installation script. You might need to direct your browser to an installation folder if installation is not automatic.

9

Pick a template to improve the look of your site. Make sure the template is compatible with your CMS.

Tips

  • check Use PHP in conjunction with MySQL to make the data on your website more dynamic.
  • check PHP can be embedded into HTML, but the file should have the .php extension.

Items you will need

About the Author

Jennifer M. Graham has worked as a chemist, a programmer and a data processor for a financial firm. She's published short fiction stories in anthologies and has traveled to the Caribbean, the UK and along the East coast of the U.S. She holds a Bachelor of Science in chemistry and a Master of Science in computer science.