PHP Usage in the Enterprise
acostin writes "Some open survey results were published about PHP usage in the enterprise on the InterAKT site. An alternative survey on the PHP open source mouvement can be found on Zend site. See how we've evaluated the PHP market size($$$), what people think about PHP as an alternative to Java and .NET, and what should be done in order to have your large clients adopt open source solutions."
For those of you that hate M$ and dont want to learn Java, its perfect.
The early bird gets the worm, but the second mouse gets the cheese!
What problems have people had in trying to migrate their applications to php, and how did you overcome them? How would you sell php to your boss? Bearing in mind most of our applications aren't simple database-driven (and I used that word hesitantly!) ones like Slashdot - hint: banking and insurance sector.
PHP usage in the enterprise
that by the 23rd century they would have left PHP behind.
Or maybe it just shows the durability of opens source software.
I really enjoy using PHP for web development. I find that you can't beat scripting languages for ease of maintenance, quick turnaround time, and tweakability.
One of the big reasons I chose PHP was the availability of "LAMP": Linux, Apache, MySQL, PHP. I know these technologies have been around for years and will be around for many more years, so it's an easy sell to management. There's plenty of talk on the newgroups if you ever get stuck and PHP's online documentation with user comments is priceless. I think more documentation should follow this example.
That aside, the pure performance and reliability of the above is excellent. These technologies were made to work together, and from what I hear the teams even collaborate to make sure their stuff stays working together. It really shows.
Years ago I worked on ASP/SQL Server solutions and where you had to go with native code for high-performance with ASP, I find that with PHP it is high performance on its own.
Great job to everyone who has helped put together these technology solutions. A shining example of the high quality that can come out of the collaborative efforts of many.
PHP is a great tool, especially if you just plan to throw something together in no time flat. Start up MySQL with PHP and Apache and you have a rather full-featured system at an affordable price: $0. On the other hand, I have no idea on reliability figures for that mixture. Still, PHP is great to work with. Easiest interface in the world.
(P.S. Lots of programmers in the Enterprise. Data and me were always slapping together code for that clunky thing. Cloaked Romulans? Yeah right--just software bugs in the sensory system. "Uh, Captain, they've gone cloaked again." "Damn! Those ships have that capability!?!" Works every time.)
For both the Zend and InterAKT surveys, there are lots of raw numbers presented, but the interpretation is lacking. The commentaries on the InterAKT results are little more than "as you can see, such-and-such wedge of the pie is the largest," and there is no interpretation whatsoever on the Zend site.
.NET, and found both of them to be too far disconnected from the HTML that I'm trying to create. PHP provides an excellent blend of power, speed, simplicity, and directness.
Of course, this is a cheap and easy way to conduct a survey (multiple-choice), but the results are almost meaningless if they can't be put into context. I would have preferred to have seen a hundred randomly-selected PHP developers interviewed, essay-style, about why they are using PHP, their thoughts on PHP versus other technologies, etc., and then have the results compiled into a journal-quality article supported by graphs and raw numbers. The important information isn't in those graphs; it cannot be enumerated and broken down into clean categories.
Personally, I develop PHP sites because it's the fastest and simplest way I've found yet to publish dynamic web content. I've tried making sites with Java and
It's hard for thee to kick against the pricks.
What do we think about PHP as compared to Java and .net? What do we think about an grape as compared to a basketball and an egg? These are 3 quite different things. A HTML-generation targeted scripting language compared to a compiled general purpose language as compared to a distributed object and language framework is a pretty disparate set of things to compare.
The language as it has been in most of it's 4.x.x iteration has been just about fine. Good for quick slap em together websites and small applications. But...
.Net) where you can rely on the functionality of the objects without having to second guess the original developers.
I have seen huge cumbersome application servers built around PHP that are a nightmare to maintain without having intimate familiarity with the code of the application server, such as Ampoliros or Ariadne, something which defeats the purpose of using such a large system in the first place. Such things really do work better with a OO by design language such as Java or ASP.Net (I assume, don't know
My guess is that PHP needs a better OO design (and no, PHP5 is not it, yet) and better seperation of logic and presentation for larger systems.
But for smaller stuff, well it's hard to beat in terms of price and speed.
is the prime enterprise use example (although they still use legacy, prepritary web programming based on C, all their new developments are run on PHP and BSD, correct me if i'm wrong)
I worked in a small shop, the web app isn't mission critical stuff like banking, but it wasn't "brainless dump data from Mysql". I was lucky that my boss was totally not picky about languages, as long as it gets the job done. But if I have anyone I work with that doubts the power and simplicity of PHP, Yahoo would be my example.
And so far, developing on the so called LAMP platform, I love PHP and would use it for any and all web development. It can be used as a quick hack (an argument always used against PHP btw, that it's only good for a quick hack and not for professional use), OR you can code it like a pro with objects et al. I was not impressed by Mysql however, it is by no means stable (this is v 4.0.13), but that's another topic.
My sig is my personal pet project using PHP
VIVA1023.com | Political Fashion.
Yeah..
To write clean, well structured PHP, you really need to do some good design, use OOP, seperate content/formatting/logic/etc, and basically at that point, you're left with a half-ass OOP implementation, annoying pass by value, messy syntax, no exception handling, etc.
PHP was meant for making relatively minor webpage hacks, and it shows. This still remains PHP's strong point; building enterprise applications (that are designed well) does NOT.
Here's my list of bitches about PHP:
* No class attributes, only instance attributes
* No namespaces (and they were dropped from PHP 5). include()/require()'ing a file just dumps its namespace into the big happy global namespace, and it's a freaking nightmare.
* OOP sucks. You have to litter &'s everywhere to get references, and lots of other problems that I'll refrain from typing out. Ok here's one -- how do you pass an instance method for use as a callback? Something like array($object, "method_name_in_a_string"). Good god.
* No exception handling. Want to "handle" an error? Toss a @ in front of it, then you'll never see it. How helpful.
* Type handling is a nightmare, sure, they make it real easy for the newbies to use numbers-in-strings as numbers, but when you're not a newbie, you begin to run into issues where it's expecting you to be stupid and as a result ends up being stupid itself, and causing you to write disgusting checks just to make sure things are sane.
And that's the root of the whole issue, I think. Things that bend over backwards to cater to newbies end up doing a shitty job for people who have a clue.
Also, if anyone knows of any projects (with source available) written in PHP that are designed well, I would be interested to hear of them. I looked at a tiny bit of PHPMyAdmin's code just for kicks and was horrified. But that's not a valid judgement by any means. Again, I'm just interested to see if there are any out there (and have a look at them).
And a last thing, I might be biased by knowing Python (but I knew PHP first!). Python tends to flow very naturally for me, and even big complex things just end up being big and complex, instead of big and complex and A COMPLETE FREAKING NIGHTMARE like big things in PHP tend to wind up (for me).
Go Python! Death to PHP!
Cold Fusion is also a web scripting language, but costs quite a bit.
.net (a proprietary collection of patent encumbered programs and methods) even more so.
The last time I compared the two (admitedly a while ago) PHP had many more features and was the much better choice. (Even if they were priced the same, which they are not.)
Even more telling is the amount of books available for each. There are seven Cold Fusion books still in print according to Amazon. (Most the same book for different versions of Cold Fusion.) A search for PHP gets 112 hits. (I am not certain how many are still in print. Much more than seven.)
Comparing Java (a general purpose language) to PHP (a web scripting language) seems to be a bad comparison. Comparing it to
"Trademarks are the heraldry of the new feudalism."
When you've laid eyes on an Apache/AxKit driven site that uses XPathScript and XSLT, then we'll talk. You want completely unmaintainable content? First, you have XML files which somehow are supposed to respresent data. Nevermind that somebody is supposed to make some kind of heads or tails of these things. Second, you have either XPathScript (.xps) or XSLT (.xsl) which is somehow supposed to transform that XML into discernable HTML that a browser can use. In the case of XPathScript, you have an wacked hodgepodge of Perl and HTML. Nothing halfway understandable like an Embperl, Mason, or even Text::Template template or component. No, go look up XPathScript to see what I mean. XSLT stylesheets are no better.
I want to believe in the XML's mission, but when I recently took up a migration of someone else's AxKit driven site, I haven't been able to get much sleep (it's 2:28am on a Friday night and I'm rebuilding a server to accomodate this goofy setup).
PHP is the coolest language for Web development today. It provides the features of Perl but designed to be a Web development language. PHP is my primary choice if the applications doesn't demand complicated business abstractions (Java scores in such situations). Using an accelerator like ionCube will be icing-on-the-cake.
No class attributes, only instance attributes
Not a big deal. Just constants or globals that are prefixed with the class name (seriously, it works fine in practice).
No namespaces (and they were dropped from PHP 5).
See above.
OOP sucks.
Yes, parts of PHP do stink, I'd love to never see a "&" again, though I think I've mostly figured it out. Also inheritance and constructors is a bit ugly. That will be fixed in PHP5.
No exception handling.
This is a big problem. Actually the only "real" problem on your list, imo. What I usually do is just die() right then and there.
Type handling is a nightmare, sure, they make it real easy for the newbies to use numbers-in-strings as numbers, but when you're not a newbie, you begin to run into issues where it's expecting you to be stupid and as a result ends up being stupid itself, and causing you to write disgusting checks just to make sure things are sane.
I actually like the way it converts strings and numbers. Just be sure not to test them as booleans and you won't run into too many problems. Since your data is usually coming from outside, you better have pages of disgusting checks to begin with!
Also, if anyone knows of any projects (with source available) written in PHP that are designed well, I would be interested to hear of them.
PEAR (pear.php.net) is a nice library for PHP. I enjoyed looking through the source code for inspiration. Sure, it's not Python (or Ruby, my fav) but it's readable and uses good practices for php.
Also, there is a site with patterns in PHP, google for it.
Also also, there is PHPUnit framework for unit testing. Not exactly JUnit (no exception handling!!) but I have been using it with "test-first" development, and churning out very nice PHP code.
I used to hate PHP because of the lax security, but I think it has a lot of potential as a "lite" language that can handle big projects. My boss loves it because he understands it, I like it because of the objects.
As a Web developer who has created Web applications in both PHP and ASP.NET, I can say, without hyperbole, that ASP.NET is one-million times better. Ok, so maybe there's a little hyperbole in there, and I know I'm just feeding a troll with this post, but I would wager that anyone with extensive experience with both PHP and ASP.NET would, at minimum, say ASP.NET is par with PHP, but would likely express that ASP.NET is better in a variety of areas. About the only negative for ASP.NET is its lack of cross-platformness, but with Mono and such, who knows how long this complaint will hold merit. Too, having Apache serve ASP.NET Web pages on a Windows box is something that is doable.
I could not justify my existence if I were a turkey farmer. Would I terminate myself? Undoubtably, yes.
If you are interested in the scripting language comparison, see Server-Side Scripting Shootout.
I could not justify my existence if I were a turkey farmer. Would I terminate myself? Undoubtably, yes.
The problem is that people *do* use it for these heavy duty tasks. "PHP Usage in the Enterprise"...
It's like a lot of things: not bad, but grossly misused. Flash is not a bad technology. PDFs are not a bad technology. Javascript is not a bad technology. The problem is that people use them for all kinds of stuff that they shouldn't, and it winds up working like crap and annoying people.
I can understand why people think that Java is slow, taking that Java GUI widgets are usually slower than native widgets on the desktop. But J2EE is not inheritably slow.
Though there are clunkly J2EE apps out there, I'd wager on a hunch, that the average J2EE app would out-perform a same sized PHP app. If we add a PHP accelerator to the mix, like Turck MMCache, then PHP may have a fighting chance.
But remember, J2EE compiles the web application only *once* at startup, and can also ( and probably does ) optimize for the specific processor that it's running on. PHP, without an accelerator compiles on every hit, and PHP can't optimize for the specific processor unless you have a good sysadmin.
Based on upvotes, Ageism is the only "-ism" Slashdotters care about and think isn't SJW
I used to think highly of PHP when I was using it for small tasks (creating a blog page and a half ass forum) but man oh man does it suck for doing big projects. In the enterprise marked, there really only one player I'd look to and that is Java. Everything else is really irrelevant. Yes Java has a steep learning curve but once you get ahead of the curve you are never going back to whatever you were using. Java + Eclipse is a deadly combination.
-----
One is born into aristocracy, but mediocrity can only be achieved through hard work.
.NET has COM+ for backend systems, Java has EJB, but PHP has nothing :(
I can't use distributed transactions, transparent failover, declarative security and transaction demarcation in PHP.
When I joined the IT department at SST (a fabless chip manufacturer), they were 100% MS. I said I would be using PHP or they would be hiring someone else. They hired me, so I went hog-wild. I hired on the guy who built edrugtrader.com, the guy who built beerotopia, and one of the developers of Yube (which is/was a primarily Java shop). We've built up a massive intranet product in PHP. It's modular, with 196 files all interoperating nicely. Thanks to our Yube guy, it's object-oriented in the most-reused parts. It has areas for file management, posting news, creating new Web pages with a built-in GUI editor (thanks HTMLArea!), org charts, a task management system, a budgeting tool, employee evaluation systems, a signoff system with escalations & delegates, a form builder, and a lot more. On a day when we post earnings, the intranet can see just as much traffic as the public site. We've sustained over 100 requests/second in a few spots, and done just fine. I know that's not Yahoo-size numbers, but it's not "small" either, I don't think. If it is small, I know that edrugtrader sees many times more traffic and performs well. So no qualms there.
The problems we've had with PHP were small in number and quickly resolved. First, 4.3.2 had a bug that resulted in blank pages displaying intermittently to our users. That sucked, but 4.3.3 fixed it. And way back about 3 years ago as we started the site, we had to increase the memory allotment for just about everything -- we had some big processes with hundreds of queries getting read into PHP arrays, and we hit the default memory limits pretty quick. Other than that, no problems. Development is quick, often easy, usually fun. If we need to go OOP, that's fine. If we need to do simple templating, that's fine too. And increasingly, we're using it outside of the Web. We have a dozen cron jobs now that are all PHP scripts. Some things, especially screen scraping and working with mailboxes, still need to be done in Perl. But lots of server management stuff -- filesystem work, data dumps, monitoring -- seems to be going along fine with PHP nowadays. I'm pretty happy to have bet my career on PHP so far.
My Greasemonkey scripts for Digg &
I have seen huge cumbersome application servers built around PHP that are a nightmare to maintain
:) Perhaps it's more common in PHP because the barrier to entry is lower.
This problem doesn't discriminate by language.
My guess is that PHP needs a better OO design (and no, PHP5 is not it, yet)
I think you could argue PHP5's OO design is good enough, or just as easily argue that it's not. I'm curious, though, what your main complaints wants with it are.
better seperation of logic and presentation for larger systems
I was looking for this for quite a while and then found Smarty. At first, it seemed so simple that I disregarded it as being glorified search-and-replace templates. The temptation is to think "I can just do that by echo variables inline." But truth is, there's much more to it than that. After giving it a fair shake, I've discovered that it's an incredible useful, clever design. It's much more functional than it seems on the surface. It made PHP substantially more useful to me.
Between PHP5 and Smarty, I think there's a pretty good basic core toolset to work with. I actually think Java tries too hard in certain areas -- too many features, too much syntax, too heavy-handed typing system, too much complication. But no question it has its merits.
- Scott
Scott Stevenson
Tree House Ideas
I'm not saying this is some ultimate solution, I've also missed exceptions badly, but if the application needs exception handling only in a few places it's quite simple to simulate them:
Far from beautiful, but you know a lot of "enterprise applications" have been written in COBOL, Fortran or C which none of them has exception handling AFAIK (if gotos don't count).
Having used both PHP and J2EE for major projects, I'd have to say that I prefer PHP because:
.NET goes, it never reached my radar since it is Windows-only.
1. It is more concise - java even _less_ compact than C++ with a good set of libraries - whereas PHP has loads of very forgiving high-level functions builtin.
2. It is more lightwight - java is just _still_ too bloated and slow even after all these years of promises from Sun.
3. The Java VM's for Linux really suck, they 'officially support' only RedHat and are unstable as hell running on Debian.
That said I really miss the J2EE ability to cache persistent data between requests in memory simply by declaring a variable as static. It's the only feature I miss in PHP.
As far as
Here's a presentation about what the following tech companies have publicly said about PHP:
c la ss.pdf
Macromedia, IBM, Oracle, Sun, Apple, Symantec, Novell, Microsoft, MySQL
http://php.ist.unomaha.edu/presentations/second
I think the biggest news is that Oracle is putting the PHP module into their 9i Application Server.
http://tinyurl.com/4ny52
You can't compare PHP and ASP.Net.
I don't see why not. They are both technologies designed to provide dynamic content via the web. Just because they require different methodologies, doesn't mean they are incomparable.
PHP is not a true object-oriented programming environment.
Where I work, we favor Microsoft technologies. I use ASP.NET and I love using it. But the object-oriented stuff gets in my way more than it helps me. OO is not the best paradigm for web development. HTTP is a stateless protocol (albiet there are layers on top of it like cookies which allow for maintianing state) so creating a whole object structure on the server to manage data is a waste of time because the objects are lost after the request completes anyway and have to be recreated on each subsequent HTTP request. And trying to build presentation using objects is a nightmare. (An HTML table as an object? Please!) No, the OO paradigm is not what makes ASP.NET better to use IMO than ColdFusion, classic ASP, and PHP (I've used them all on other projects at other companies). The part where ASP.NET shines is the separation of presentation from code. In a properly coded ASP.NET page, almost no server side code is present in the aspx page, and all of the work is done in a "code behind" area. That is what I find lacking when using PHP - not an overrated OO-for-the-web paradigm (OO is great for other things though), but in a proper MVC architecture with separation of code and presentation.
On top of that, the PHP language is not strongly typed, and you don't even need to declare variables
Truthfully, I see that as an advantage of PHP over ASP.NET. Yes, traditionally weakly typed languages perform slower than strongly typed ones, but other than that the advantage of not having to deal with excessive casting is a fantastic advantage. You may argue that it allows for bad coding practices, but I'd counter with "what language doesn't?". If you want to be stupid about it, any language will let you do things wrong. Languages like Java try so hard to force you to do things right, it ends up being at the expense of useful functionality. No thanks.
PHP has no structured exception handling
Yeah, I agree. That does suck.
When performing operations like variable assignment and passing the object as a parameter to a function, the whole object is copied
I think that depends on your point of view. Not having the option sucks though.
On the other hand, ASP.Net is a true OO language, with inheritance, polymorphism (overloading of methods) and encapsulation. ASP.Net is strongly typed. ASP.Net is compiled and JIT'd.
I don't mean to sound snotty, but my honest reaction here is "so what?". OO is a great paradigm for other things, but it falls short when trying to use it for web development. And, being compiled arguably makes ASP.NET harder to debug. I'm no fan of VB, but at least the VB environment allowed dynamic changing of code during a debug session without having to stop the debugger, recompile the code, and start again. Interpreted languages are not nearly as slow anymore as everyone claims them to be, and in the real world it seems that rapid application development will win out 9 times out of 10 over rapid program execution. A lot of bad architecture decisions are made in a falsely percieved need to boost speed all the time (just ask the Java camp about the state of affairs in the late 90's).
IMHO the good parts about PHP are also the bad parts. ie, * you don't have to say what type a variable is, but that means you can't specify a type of parameter to a function. * you don't have to specify scope, but then you can't protect functions that should be private etc.
I looked at a lot of Java code for ideas on what I could do with PHP to clean it up . The main things that I did were: set up a 3 or 4 tier architecture.
- database abstraction layer
- business layer
- presentation layer (preferably using templates)
(I modeled a lot of this on Enhydra - www.enhydra.org)never use globals. Wrap up the HTTP_GET_VARS, HTTP_POST_VARS etc in a class (ie Request). Create classes to wrap the server vars and whatever else.
Use classes for everything. This gives you a reasonable amount of namespace control.
Never access variables directly in classes. Create accessor methods for them.
I think that if you are feeling the need to structure your PHP, you will probably need to move towards Java or some other more structured language. It can definitely be more challenging to write, but as your applications get bigger, the compiler-enforced type checking, programatticaly enforced/supported interfaces etc will save you a lot of time in the long run.