In a previous blog post, I looked at what Enterprise Applications are and the challenges they pose. Here, lets examine PHP’s role as a useful tool in building them.
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.
For a thorough examination of Enterprise Software, Martin Fowler’s “Patterns of Enterprise Application Architecture” is an excellent book.
See also: an interesting discussion on whether PHP is ready for the enterprise.
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.
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.
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).
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.
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.
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.
Comments
2 comments
Top Rated Web Hosting said... 1st Jan 2010, 05:11
PHP is a dynamic coding language and has been around for a long time. It can be used in many different applications. Of course PHP has its downsides and security vulnerabilities, but is still a reliable form of code. If you need a website that fully supports PHP, check out this:
http://www.WebHostReview1.com
Laran Evans said... 12th Jan 2010, 09:35
More importantly that the properties you mentioned, I feel that the term "Enterprise" is more about the ability to deal with complexity, particularly in terms of how an application integrates with other applications.
In this area PHP is atrocious. For instance, PHP has no package structure. PHP 5.3 introduced the concept of namespaces. This will help.
Generally speaking, modularity is a key property in any application designed for the enterprise. PHP was never initially intended to be modular. It was originally intended for simply serving up web pages. Object support came much later. Namespaces came even later.
Ultimately I feel PHP is a simple language that's trying to "grow up" in order to gain adoption in the enterprise. In contrast, true "Enterprise" languages such as Java and .NET were designed from the ground up to cater to enterprise needs.
Given that there are already languages, and more importantly tools in those languages that I consider to be FAR better suited for the enterprise, I don't see any reason to introduce PHP into the enterprise setting. I'm a strong believer in there being at least one best tool for any job. When it comes to building applications that integrate and inter-operate well with other applications, PHP just doesn't seem like a good fit.
Your thoughts?