I always hear that PHP is for medium and small websites whereas .NET and Java for enterprise applications. My question is about PHP. Why is PHP not a good option for enterprise web applications? Is it because if the web application becomes bigger then PHP will be slower as it is an interpreted language?
I know that corporate world will choose .NET or J2EE because of the integration with their products and because of back end services, etc. However, if we just have PHP for building sites and web applications then how can we use it to perform well with big sites?
In short, Is there a relationship between the performance of PHP and the size of the website?
What are the factors that make PHP not appropriate option for big sites?
Best Answer
Performance is probably not one of the factors. For a dynamic language, PHP actually performs pretty well; depending on the task, it might or might not beat other technologies. The application model simply is too different to compare it directly against Java or ASP.NET. Even if there is a measurable speed difference, it is not big, and it's probably linear, which means it can be solved by throwing more hardware at it. Also, the programming language itself is seldom the bottleneck - algorithms, database access, network bandwidth, and I/O in general are the usual culprits, unless you are writing somehing truly CPU-intensive.
Reasons for using ASP.NET or Java over PHP that are more likely include:
Another reason for the perceived effect is that PHP is free (as in beer) and ubiquitous - every cheap shared web hosting company has PHP in their standard package, but a .NET or Java server is going to cost you significantly more. Consequently, a huge mass of small websites uses PHP, not because it's the best tool for the job, but the only one at hand.
That's not to say PHP is unsuitable for large projects - it just doesn't go well with the 'enterprisey' kind of programming. Its strengths lie elsewhere, and if you can leverage them, you can just as easily build large-scale applications as you could with any other web technology.