PHP - My SQL (Chapter - 1: Introduction to PHP)

What is PHP? , PHP Requirements, How to Create A PHP File

1. What is PHP?


PHP is a widely-used scripting language intended for use in web pages to create dynamic content.

PHP runs on a web server, which interprets the PHP scripts behind the scenes and sends the results to the client. The client may not even know that a script was used to produce the contents of the webpage that they are viewing.

Although PHP is considered to be a simple language, it comes with an extensive list of features that allow it to be used in thousands of different ways to enhance websites and web applications. These uses include, but are by no means limited to:

  • Solving Math Problems
  • Displaying Current Dates & Times
  • Handling Form Data
  • Sending & Receiving Cookies
  • Collecting Information About Your Website's Visitors
  • Tools to Read From & Write Data to Databases
  • Creating/Modifying Images
  • Creating Shopping Carts
  • Interacting With a Secure 3rd Party to Pay For Online Merchandise

PHP is a free open source software already installed on many web servers today.

PHP stands for "PHP: Hypertext Preprocessor". It is a recursive acronym.

2. PHP Requirements


Since it is safe to assume that you have access to a browser, a computer, an electrical socket to plug in your computer, and a power plant to generate the power available to your electrical socket, then the only remaining requirement to run PHP are either one of the following two options.

  • A web host (server) that supports PHP.
  • A web server and PHP installed on your own computer.
(PHP can be downloaded here and installation help can be found here.)

Later on we will discuss using PHP as a tool to interact with a MYSQL database, so it would be best if your host came with MYSQL already available.

This tutorial assumes that you have no previous experience with programming, however some familiarity with both HTML and uploading files to a web server will be necessary. Please read my HTML tutorial if you need to learn or review this subject.

3. How to Create A PHP File


Any file containing PHP must have a ".php" file extension, similar to how HTML files, to be identified as HTML files, must have a ".htm" or ".html" file extension.

PHP files can contain HTML in the same file, and still work properly. HTML files, on the other hand, cannot contain a PHP script and still work properly, because the PHP code will be read and displayed as HTML.

Also, while HTML files can be viewed in your browser from your own computer, PHP files must run on a PHP-enabled web server and be viewed with your browser by going to the file's URL (usually the website name + the file name + the file extension, for example: http://www.yourwebsitename.com/test.php).

I would not recommend the use of word processors (ie. Microsoft Word, StarOffice Writer, or Abiword) to save or create PHP files. Text editors such as Notepad or Wordpad on Windows machines, and Kwrite or Kate on Linux machines, are a better option. When saving the file, make sure that you type in the file name and the extension (example: test.php) and that if there is a "Save as Type" dropdown option, that the type is set to "All Files".

Continue to Index

Welcome to HoneyBee - The Learning Platform

By Binit Patel

HoneyBee is a learning platform which is an integrated set of informative online services that enable learners involved in education with information, tools and resources to support and enhance Teaching, Learning and Management.

Contact With Me