php as a high-end development environment

A friend is looking at using php as the primary language for a pretty ambitious web-based application. I’ve used php a little, and I’ve always thought it clever for small projects, but not really ready for prime time when compared with .NET or J2EE. However, I don’t have any real facts to back that up, and I’m having trouble finding any.

So I put it to the masses: is php really viable for a large, ambitious web application? Or are my gut feelings that it’s lacking in features correct?

As of April 2007, Netcraft reports PHP was being used on 20,917,850 domains and 1,224,183 IP addresses.

This web site says PHP has a greater market share than ASP, as of November of last year.

Perhaps you should base your evaluation on what you want to do vs the best application to do the job in terms of customer service as well as technical admin to support it.

That’s what I’m trying to do.

Stats that say PHP is more commonly used than other environments isn’t very useful. I’d bet there’s gazillions of small web sites that use phpBB, for example. What I want to know is if it’s got the Dev Environment/Tech Support/Technical prowess to compete with J2EE/.NET.

Put it another way: I’m very comfortable saying “If you build a web site using the latest Java or .NET environments, you’ll be able to do just about anything you want, and there’s a great deal of tech support out there to help.” Can I say the same of PHP?

And another way to say it: “If I want to build the next Amazon.com or Youtube.com, can I do it in PHP?”

Well, Amazon.com runs primarily on Apache/mod_perl, and YouTube is mostly implemented with Apache/mod_python.

So, two votes for two of my favorite platforms. :slight_smile:

Anything I say about PHP’s usefulness will be colored by my intense loathing for it, so don’t listen to anything I have to say.

Facebook, one of the most popular social networking sites, is built on PHP.

So is Digg.

Yes, its definitely very scalable and certainly ready for huge websites. It doesn’t offer the flexibility that .NET does of ease of turning it into a desktop application, but if you’re keeping it on the web, I’d say you’d be safe with PHP.

From what I’ve heard, PHP tends to have scalability issues. There are plenty of examples of big websites that started off using PHP but eventually had to do an entire re-write in .NET or Java(I read an article on this a couple of years ago but I don’t have a link anymore).

PHP’s main problem for large sites is that it doesn’t require you to declare variables, which can be a hastle to track down and debug. Other than that it has a great API that is large enough to do anything you could ever want to do, while still fitting in a reference manual that doesn’t take an hour to download. That’s certainly not true of Java, where the API is larger than human could ever possibly need, and yet none of the 20 ways of doing the same thing ever seems to do what you want quite right.

I’ve not used .NET, but from talking with my brother who has, I believe that it has various objects that represent HTML elements in code, which allows you to write in one language rather than writing an HTML page with embedded PHP. If you create a library of HTML objects in PHP, you can accomplish this there as well, but of course you have to have it.* But I believe that a lot of the things that .NET gives to simplify webpage making will end up locking you in to IE if you use them.

I have no idea what Java Servlets look like for programming webpages, so I can’t comment.

  • Just PM me if you want to see/use my HTML object library in PHP.

Not true. There’s a few you might have to worry about but on the whole, most things work. I’m primarily a .NET developer, and my main browser is Firefox.

Thanks everyone for the feedback. It seems that php is more powerful than I originally thought.

I wouldn’t use PHP for that but that’s just because I think it’s ugly by itself and it makes structuring systems even uglier - thus discouraging building a well-structured system (but I like perl, so I admit there’s no accounting for taste). I also think that the benefits of PHP compared to the other popular “no-strict typing” languages like python and (mod_)perl trail off when you’re building complex multi-node systems. IMO the advantage of PHP is mostly easy and cheap deployment. When you’re building complex systems, who cares that you won’t be able to host it at your $5 a month provider when you’ll be spending a couple of thousands of dollars on hardware and a hundred or more a month on rack space anyway?

That said, if you have a good team of developers I have no doubt you could build a good, large, high-performance system in PHP (with possibly some C extensions). If you’d force me to choose I would prefer PHP over Java in anything not absolutely requiring multi-threading.

What does “powerful” mean to you? You can use php to build a relatively simple, nonfederated web app with rich behavior that can handle massive amounts of traffic. This seems like a stunning amount of power to some, mainly those who have never worked with enterprise software. When you get to distributed queuing systems designed by teams that are likewise widely distributed, though, you need a language with better structure and better back-end frameworks available (like Java or .NET).

Of course someone will say “but you COULD do that in php too”, to which I would respond “yes, you could also build a car out of chocolate, but that doesn’t mean you should.”

I’m with you; I realized when I posted the OP that I’d be getting a range of answers.

I tend to have the same bias you do. My background is primarily Enterprise-level applications, and I’m a Microsoft girl from way back. Big systems are my forte, and I don’t have a lot of patience for half-assed development environments. Personally I don’t even have much patience with Java because I think it sucks ass compared to .NET. But that’s a religious debate, and this isn’t the place to get into that.