Tuesday

PHP's Place in the Enterprise

PHP in the enterprise

PHP claims to be the most widely used programming language on the web. A quick look at http://langpop.com/ supports this – it’s almost certainly the most common for smaller web projects. PHP was not originally designed as an enterprise-level language, but as it has evolved, it has become suitable for much larger projects than were originally envisaged when Rasmus Lerdorf produced PHP/FI in 1995 (source). PHP now supports SOAP, XML-RPC, JSON and any database platform you care to mention.

For something to be considered “Enterprise-level”, i.e. ready for use in the enterprise, it should meet the criteria of the Enterprise Challenges examined in our previous blog post.

PHP as an Enterprise-level language

With PHP 5.3, PHP is a full object oriented language with exception handling and useful features such as closures. Let’s take a look at PHP in light of enterprise challenges.

Scalability

PHP is very scalable owing to its shared nothing architecture – Facebook, Yahoo and Flickr, for example, are huge apps that tackle many Enterprise problems such as scalability, security and robustness using PHP.

Whilst PHP does not itself explicitly support concurrency (each PHP request is a single request and response), its host server can handle the instantiation of requests. PHP is very fast, and can horizontally scale extremely easily, often as simply as adding instances to a cluster of servers. This means the data throughput and concurrent users challenges can be overcome.

Robustness

Because each request runs in isolation, PHP is less likely to become deadlocked than a multithreaded language such as Java. There are tradeoffs, however – Java’s sophisticated mutual exclusivity functionality can protect vital areas of data, whereas two PHP processes may update them at the same time. This can push a certain amount of work onto the database, but as such, is easily solved (and, some may argue, may be better handled by the database system anyway).

Frameworks

Enterprise application development can be expedited with sophisticated frameworks to abstract away tasks, help organise code, and provide functionality rather than re-inventing the wheel. There are frameworks available for PHP, the most prominent being Zend Framework. Zend Framework is robust, thoroughly unit tested and can be a strong platform for enterprise applications. Jim Plush, a senior developer at Panasonic, blogs about his experiences with it. eZ Components is another enterprise framework for PHP focusing on providing re-usable components.

Security

Compared with other languages, PHP is neither particularly more or less secure; out of the box it may lack much of the explicit security support provided in .Net, for example, but one of PHP’s main strengths is the wealth of libraries available through PEAR and PECL, providing a range of simple and sophisticated security options.

Summary

PHP warrants its burgeoning place in Enterprise application development, but should be used where appropriate, wherever possible taking advantage of existing libraries and frameworks rather than rewriting. As web developers, as our medium moves to a more social environment, we can learn much from the established enterprise frameworks and applications that are already serving millions of users.

Curtsy: Posted by Gavin Davies on 18th Dec 2009

No comments:

Django URLs

In Django, the urls.py file is where you define the URL patterns for your web application. There are several ways to write the urls.py fil...