What is PHP and when should we choose it?
PHP is a programming language created and developed as a tool for web programming. It has a long history, millions of fans throughout the world, and the number of websites built upon this particular platform has probably reached hundreds of millions by now. Yet it is not without its disadvantages – and, consequently, not without rivals.
Having been created as early as in 1995, PHP still – to this day – has no formal specification. It grew out of a set of Perl scripts written in 1994/1995 by a Danish programmer Rasmus Lerdorf who named his creation Personal Home Page Tools or PHP Tools. He indeed created it for his personal use. But in November 1997 a development team released PHP/FI 2 – officially a new programming tool.
PHP was originally thought of as a Hypertext Preprocessor designed to produce dynamic web pages. Its code can be embedded into the HTML source document where it gets interpreted by the web server and produces a web page whose content is controlled by the PHP script and the data supplied to it by the server.
The usual requirements of better separation of the business logic from the presentation and the programmers’ desire to work with object-oriented code has dictated further development of PHP. The third version of the platform was standardised and released in 1999, the fourth in 2000 and the fifth in 2004. PHP 5 has the best support of the concept of object-oriented programming, but compatibility has suffered, and many PHP-based products now have to have two versions of installation packages: for PHP 4 and PHP 5 respectively.
PHP is easily learned even by the beginners, which is one of the main factors defining its extreme popularity, but led to singificantly lowered code standards among the PHP community. Experienced PHP developers are trying to tackle that by introducing more refined coding habits and standards to prove that it’s possible to write clean, highly professional code in PHP, but the stereotypes are hard to beat, and PHP has acquired a reputation of a platform that encourages loose coding practices, also probably due to its lax way of dealing with variable types. We’d like to emphasise again that the problem is not in the platform itself but in the person who does the coding.
PHP has been used for many serious, large-scale projects, which won’t tolerate untidy coding. Many popular free CMS’s (Drupal, Joomla) and even some proprietary ones (Bitrix), the popular WordPress blog platform, multiple forum and social networking scripts and even MediaWiki – the script powering the Wikipedia web-giant – are all written in PHP.
PHP has serious advantages which have defined its popularity: it is usually bundled with nearly every hosting package, excluding the cheapest, it’s fast, easy to configure and couples very well with another popular free product: the MySQL database engine. Together, these two free solutions allow website owners to have an efficient website at a reasonable price. They are fast, light and don’t require a powerful web server.
Together with Linux operation system and Apache web server, PHP and MySQL have formed a software bundle called LAMP. The acronym was coined in 1998 and quickly gained popularity. An equivalent installation package for Windows is known as WAMP. It is a complete solution for supporting application servers. The majority of web servers use the LAMP solution, since every element in this combination is free, light, easy to use and perfect for its respective role, and all four go together extremely well. Sometimes PHP is replaced in LAMP by Perl or Python, but of the three P’s PHP is by far the most popular due to its advantages mentioned above.
Yet there are disadvantages also: for example, most PHP-based scripts easily get hacked. But this can be fixed by using proper programming practices and obfuscating the code.
PHP is recommended if your website doesn’t need too complicated business logic, but it’s essential that you receive the product quickly and host it on a relatively cheap web server. If the costs of hosting and the duration of the development phase are less essential, but the business logic requires large amounts of custom programming, Java or .NET could be the preferred solutions. A lot depends on the team you have chosen to build your web application for you: whichever platform they work best with is probably your best choice.