Software Development, Web

Why use PHP?

If you are looking to create dynamic functionality on a web site, there are no shortage of options for the server programming language. So why use PHP?

Free to obtain and use

The source for PHP as well as binaries for most operating systems are available free of charge for download either from PHP downloads page or OS specific sites or package managers. There are no ongoing license fees to run a PHP install. Common web servers which you will also require such as Apache are also freely available.

Easy to set up

The various package managers for Linux distributions make a PHP based web server install easy. There are also alternatives such as XAMPP & WAMP which can install required components and extras such as MySQL, on Windows and Linux.

Easy to get coding

Creating and editing PHP code does not require any fancy software. A simple text editor such as vi or Notepad is all you need. The are many free text editors that provide extra functionality such as colour coding, autocompletion and syntax checking. Full blown integrated development environments (IDE) are also available which can assist with other bells and whistles.

Easy to achieve results

PHP integrates seamlessly with HTML code, and the two can sit side by side in a single code file. A static html page can quickly be made dynamic through PHP conditional statements and looping. There is also a huge amount of existing PHP code (snippets, classes to full frameworks) that can be quickly integrated with new code to produce powerful results in a short time frame. This is also a potential downside of PHP. What is quick and easy today, can be a maintenance nightmare tomorrow.

Third party Code

PHP has many hundreds of inbuilt functions, and very wide range of connections for databases, web services etc. However there will be the need for functionality that is not built into PHP? Most likely other developers have had a similar need, and in the spirit of sharing or profit, these solutions are often made available. 2 official sources are PEAR (PHP Extension and Application Repository) & PECL (PHP Extensions repository). Here you can find numerous classes & packages to provide extra functionality. But this is just the tip of the iceberg. Numerous sites provide code code, and there are no shortage of PHP component frameworks, such as ezComponents & Zend Framework to name just 2, and class code sites such as PHP Classes. Note: Always buyer beware on third party code.

No forced development style

PHP is very flexible in how developers can use it. Procedural programming or object orientated. Monolithic scripts with intermingled functionality or well defined and separated solutions. It is up to the developer based on their preference and experience to create their own solution, and none is forced upon them.

Portable

PHP is an interpreted language, and PHP code is highly portable. Correctly written code can be easily moved from one OS to another, and should preform the same function.

Widely deployed

Not only is PHP available for all the major operating systems, external PHP powered web servers are extremely common. PHP is standard in most web hosts offerings, from the cheapest to the high end.

Excellent support base

PHP Manual

The PHP manual which is online and can be downloaded locally (almost 4Mb compressed) is available in English and many other languages, and goes far beyond a simple function reference.

Fellow Developers

Have a problem with your PHP code, there are no shortage of forums and groups which you can ask questions at. Many programmers also share their experiences of problems and solutions, so a google search will generally bring back plenty of ideas for solutions.

Books

There are plenty of books on PHP from getting started to issues faced by the largest of applications.

Standard