What is PHP?

May 1st, 2012

PHP (acronym for PHP: Hypertext Preprocessor), is an open source server scripting langauge that is especially suited for Web development.
The language was released in June 1995 and was originally called “Personal Home Page”.
PHP is by far the most popular server language and it powers the vast majority of server scripted websites.

  • PHP is Open Source software.
  • PHP is free to download and use.
  • PHP supports many different database languages (MySQL, PostgreSQL, Oracle, Sybase etc).
  • PHP is so well supported, making it easy to learn.

PHP Logo

The PHP website is the home of the language and you can download the correct package to suit your OS.
The PHP manual can also be found on the site. Here is an example page from the manual on the Substring function. Not only does it include a description of the function, but there are various code examples from people who wanted to share their knowledge with the community. The PHP community has played a major part in making the language so accessible and well documented.

Getting Started

To run PHP, you need to install Apache server and you may also require the MySQL database package. Newbies can find the experience of installing these packages quite overwhelming. By far the easiest way to get started is to download the excellent Xampp is an easy to install Apache distribution containing MySQL, PHP and Perl. The Windows version comes with an installer which installs everything neccessary the get you up and running. Purists argue that this approach teaches you little about the installation of Apache and PHP. Whilst I agree with this, I think it is too much of a learning curve to delve into the inner workings of Apache server for the newbie.

I made a video to show the installation process:

I started out writing static markup pages using HTML, but got frustrated because I could write feedback forms but couldn’t do anything with the submitted data. Various hosting companies offered CGI scripts to process form data, but the big problem was that I wasn’t in control of the process! Learning PHP was the single most important thing I ever did. When you combine knowledge of PHP with HTML, CSS and Javascript you have a really powerful set of skills.

People often get confused as to what PHP can and more importantly can’t do.
I often get asked “Can you trigger a PHP function from a button Click”. The answer is a definite NO because PHP is not a client side language.

What is Client side code?

Client-side scripting enables interaction within a webpage.
The code required to process user-input is downloaded and compiled by the browser or plug-in. An example of client-side interaction is this rollover which is written in Javascript.

What is Server side code?

With server-side scripting, completing an activity involves sending information to another computer (server) across the internet. The server then runs a program that process the information and returns the results, typically a webpage. PHP is classed as a server language.