Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Programming IT Technology

PHP Succeeding Where Java Has Failed 610

ficken writes "Web browser pioneer Marc Andreessen recently announced his prediction that PHP will be more popular than Java for building web-based applications." From the article: "Wooing programmers is nothing new in the computing industry, where players constantly jockey to establish their products as an essential foundation. Indeed, many credit Microsoft's success to its highly regarded programming tools, which make it easier for developers to write software that run on Windows. PHP has caught on widely. About 22 million Web sites employ it, and useage is steadily increasing. About 450 programmers have privileges to approve changes to the software. Major companies that employ PHP include Yahoo, Lufthansa and Deutsche Telekom's T-Online." Meanwhilie, Piersky writes "Zend has announced its rival to .NET and J2EE, with the Zend PHP Framework. In a press release, they stated that it will be 'A Web application framework which will standardize the way PHP applications are built. The Zend PHP Framework will accelerate and improve the development and deployment of mission-critical PHP Web applications'. This will for part of Zend's PHP Collaboration Project"
This discussion has been archived. No new comments can be posted.

PHP Succeeding Where Java Has Failed

Comments Filter:
  • The Success of PHP (Score:3, Informative)

    by kihjin ( 866070 ) on Friday October 21, 2005 @10:17AM (#13844153)
    About 22 million Web sites employ it

    Well, of course. PHP works for free.

    Wondering where the '22 million web sites' comes from? http://www.php.net/usage.php [php.net].

  • Imposter Boy Speaks (Score:0, Informative)

    by Anonymous Coward on Friday October 21, 2005 @10:19AM (#13844172)
    Everything you need to know is in this article [64.233.167.104]

    Netscape always controlled the media when it came to the story about how the browser was first built. This is the only article that I've ever seen that actually went back to the place where it was created to find out the real story.

    History is written by the victors.... Even if that "history" isn't true.
  • Re:Help me out here (Score:5, Informative)

    by TheSpoom ( 715771 ) * <slashdot&uberm00,net> on Friday October 21, 2005 @10:20AM (#13844179) Homepage Journal
    You're pretty much correct. PHP is a lot closer to JSP or ASP than Java, and yes, it can violate separation of logic and presentation. However, you can use the Smarty templating library [php.net] to separate code and presentation (and I recommend this to anyone learning PHP, because embedding PHP in HTML makes for very sloppy and nigh unreadable code).
  • Re:PHP can do allot (Score:5, Informative)

    by christopherfinke ( 608750 ) <chris@efinke.com> on Friday October 21, 2005 @10:21AM (#13844182) Homepage Journal
    I'm very impressed with how far PHP (Personal Home Page) has gone.
    PHP hasn't stood for Personal Home Page for a long time. It stands for "PHP: Hypertext Preprocessor."
  • by Piersky ( 903281 ) <slashdot@pierso n t h e .net> on Friday October 21, 2005 @10:21AM (#13844183) Homepage
    Actually it comes from Netcraft
  • Re:PHP can do allot (Score:3, Informative)

    by totallygeek ( 263191 ) <sellis@totallygeek.com> on Friday October 21, 2005 @10:22AM (#13844195) Homepage
    I'm neither a java or php programmer, but I do work with both. While java is nice and portable, I'm very impressed with how far PHP (Personal Home Page) has gone. There are acclerator projects out there that cache php scripts, making them much more responsive. I use eAceelerator (formerly MmTURKE Cache or something like that) and it's obvious that php performance can be improved. For many a simple LAMP setup is very powerful, I've been using it for a website, as well as webmail, for over 4 years now.


    Two things:

    • Java may be portable, but a fair percentage of applications written with Java, both corporate and Internet, work only for an intended audience of operating systems. Java has evolved out of its starting premise of platform-independence.
    • PHP no longer is referenced as Personal Home Page. It is the PHP Hypertext Processor. For some reason, corporate types won't let you use something with the word personal in it, but annoying recursive acronyms are acceptable.
  • Re:Help me out here (Score:2, Informative)

    by Anonymous Coward on Friday October 21, 2005 @10:22AM (#13844196)
    You can separate presentation and logic in PHP just fine, and once you come to doing templates you can use a really powerful templating language - PHP.
  • by ChrisRijk ( 1818 ) on Friday October 21, 2005 @10:24AM (#13844207)
    http://www.zend.com/news/zendpr.php?id=107 [zend.com]
    Zend Technologies, Inc., the PHP company and creator of products and services supporting the development, deployment and management of PHP-based applications, today announced Marc Andreessen and Gaurav Dhillon as the newest members of the Zend board of directors.


    Little "full disclosure" for everyone.

    PS There's more to Java on webservers than J2EE. There's also multiple Open Source versions of J2EE.
  • by totallygeek ( 263191 ) <sellis@totallygeek.com> on Friday October 21, 2005 @10:30AM (#13844260) Homepage
    I am an owner of a software development company, and I can tell you that both have their place. All languages (and sadly, operating systems) are tools and it makes sense to use the right tool for the job. Languages we may be using depending on the task include C, Pascal, DataFlex, Java, PHP, Perl, Python, and even bash. Someone might ask why Pascal; which is because we have a well-defined set of libraries for that language which allow us to access many other applications, which in another language would be difficult or expensive to recode.


    All that aside, we typically use PHP for all web-based applications. The ease of coding, and the ability to affect change with zero downtime is a big plus. We can have several programmers affecting changes in one codebase in real time. And, for a program which took us six months to develop in PHP, it would have taken at least fifty percent longer with Java.

  • screw 'em both (Score:2, Informative)

    by SCHecklerX ( 229973 ) <greg@gksnetworks.com> on Friday October 21, 2005 @10:41AM (#13844343) Homepage
    I'll stick with embedded perl, thanks. It does what I need, and I am already familiar with it. All the benefits of perl and mod_perl, with the simplicity of embedding into a page. I'm sure PHP is nice, but why bother learning it?
  • this is sad (Score:4, Informative)

    by namekuseijin ( 604504 ) on Friday October 21, 2005 @10:45AM (#13844372)
    The alternative to extremely bloated and redundant java and .net web technologies is an extremely basic (old)ASP-alike with all functions and variables sharing the same namespace and global variables running wild. Granted, it's easy. Just as easy as notepad and just as featureless and error-prone...

    Hey, i'm just as annoyed at java and .net as everybody else, but i'd point to Python, Ruby, Perl or Tcl technologies rather than this sub-Perl refugee...
  • by duncangough ( 530657 ) on Friday October 21, 2005 @10:53AM (#13844450) Homepage
    Beat me to it, of course he's going to say that PHP is catching up on Java in the enterprise since that's where they want to take it and that's where the next pot of gold is.

    Sadly, PHP has hit a brick wall recently. There are backward compatibilty problems with PHP4 (not helped by the developers telling the community to stfu, noobs), PHP5 is not being picked up at any rate of knots and now people are look to PHP6 to fix all their problems. Ruby looks better by the day, to be honest.

    --
    Millionsofgames! [millionsofgames.com]
  • by Crayon Kid ( 700279 ) on Friday October 21, 2005 @10:55AM (#13844467)
    However, the real strength of these systems is not in themselves; they are built on a superb platform base which provides Threading, IO, Networking, Graphics, Db access, i18n,and all the things a programmer might ever require. PHP doesnt have anything remotely similar, as far as i can see.

    OK, this is a troll if I ever saw one and may I be damned for feeding one but here it goes:

    Go look at PEAR [php.net] and the PHP manual index [php.net] and then tell people PHP doesn't have a platform offering all those.
  • by coder111 ( 912060 ) <{coder} {at} {rrmail.com}> on Friday October 21, 2005 @11:02AM (#13844529)
    There's usually no need to integrate PHP with Java and use PHP for page rendering, because there are tools in Java that do page rendering just as well as PHP, if not better. If you need integration anyway, you can integrate Tomcat with Apache- then all your static (images, CSS) and PHP stuff will run on apache, for java stuff tomcat will get called. This will both increase performance (as Apache is better suited for serving static stuff than Tomcat) and allow PHP to be used on same box, same port.

    Java is not slow in server-side, it is just slow on desktop with Swing. Get Tomcat and try benchmarking some JSPs if you don't believe me. Templates with java might be slower than JSP, but anyway, page rendering is something that impacts the performance of web application the least.

    With java you EXTREMELY RARELY need to write extensions, usually you can find java libraries (most of them open source) that do the stuff you need. Or you can just use standart java class libraries, that are enough for 95% of cases. This way you can get a platform-independent solution for no additional cost. While your DLLs (.so's?) will have to be compiled for each architecture, coded to be cross-platform, installed by system administrators, etc.

    If you need to interface with C++/C, there is JNI (Java native interface, It is hairy and unfriendly though). Of you can integrate via some kind of interprocess communication (pipes still work, as will TCP, with java you can write TCP client/server in 10-30 lines of code). This way you can have any language on the other side of IPC. You can use webservices/CORBA/XML RPC if you want to be fancy.

    --Coder
  • Re:Help me out here (Score:4, Informative)

    by __aanonl8035 ( 54911 ) on Friday October 21, 2005 @11:08AM (#13844571)
    I find it strange how people recommend Smarty for separation of code from content. Smarty implements its own while loops and if then statements. I have yet to come across a web application using Smarty that was easily readable. I would think if the goal was to separate code from content, one would use a templating engine more akin to QuickTemplates [sourceforge.net]. It does not make you relearn a whole new programming language syntax for while loops and if then statements like Smarty does.
  • Re:Help me out here (Score:3, Informative)

    by Randolpho ( 628485 ) on Friday October 21, 2005 @11:11AM (#13844597) Homepage Journal
    Separation of concerns (code in your presentation layer) is a design issue, not a language issue. Calling PHP a bad language because you can put code in your presentation layer is like calling water bad because you can drown in it.
  • by masklinn ( 823351 ) <.slashdot.org. .at. .masklinn.net.> on Friday October 21, 2005 @11:13AM (#13844615)
    Best part about PHP is extensions, just write some C++ code(or C#/VB.NET on windows *frowns*) and make it a DLL, set it up and use it.

    That's called a theory. It's much harder to build in reality, and mostly sucks anyway since you still don't get any namespace and have to decorate every damn function like there was no god.

    not easily available as Java yet because no as many people use it yet

    Thing is in Java you can write your extensions in Java (the JIT compiler is running behind so perfs are good anyway), or use JNI to use C/C++ compiled modules.

    Or you can do it the Nice Way and just hop on to Python or Ruby, get full OO, namespaces, and modules (including native compiled) that are actually fairly easy to build.

    With batteries included

  • by dun0s ( 213915 ) on Friday October 21, 2005 @11:19AM (#13844661) Homepage
    Sites that suffer the /. effect do so because they are not expecting the traffic. In the same way that very large enterprise websites that suddenly release XYZ bit of software for download by the marketing department who never told the IT department also suffer a similar /. effect. It isn't always the language or the programmer or the scaleability of the website. It all depends on what level of traffic is expected.
  • by Anonymous Coward on Friday October 21, 2005 @11:20AM (#13844669)
    You find php's pdflib inadequate for your needs?

    Why yes, yes I do. In Java I can use PDFBox to merge pages together, populate form fields, and literally tear apart and put the PDF back together. Manually. By object. With encryption.

    Combined with the power of FOP (FO -> PDF) and SVG, PDFLib doesn't hold a bloody candle.
  • by bigtrike ( 904535 ) on Friday October 21, 2005 @11:32AM (#13844788)
    I've used PHP for years and by now I have a love/hate relationship with it. Some of my biggest issues with php are:
    • Lack of binary compatibility even on debug fix releases. My code shouldn't stop working when I upgrade from 4.3.2 to 4.3.3 due to an undocumented addition of a run time warning
    • Error reporting must be turned down well below useful levels in order to use PEAR in PHP 5. Ignoring E_NOTICE level warnings is usually a very bad idea, but necessary until PEAR works in PHP 5
    • Code can't be entirely compatible with PHP 4 and 5 standards (var produces warnings in PHP5, public/private does not work in any PHP 4)
    • Lack of standardization of function naming and argument order. I always have to check whether the function I'm using has an underscore between the words and whether it's needle, haystack or haystack, needle
    • Kitchen sink approach. Again, all functions are in the same namespace. This results in some pretty weird function naming
    • Lack of great debug support. xdebug sort of works, but is still very immature
    • Loose typing. You have to study the documentation very carefully in order to understand how to compare variables and get the expected result. In addition, since type conversion is automatic and performed on numbers when they exceed certain ranges, precision may be lost unless you have a very detailed understanding of how and when type conversions happen and plan out the numerical ranges of your variables accordingly
    • Caveats with unset()/isset/null/arrays


    PHP may have a bunch of issues, but it's still the best tool for my job.
  • by vidarh ( 309115 ) <vidar@hokstad.com> on Friday October 21, 2005 @11:32AM (#13844791) Homepage Journal
    You mean like PHP-GTK [php.net]?
  • Either Ruby (and RoR) or Python (and Django, Zope, the terrific TurboGears or any other framework) would probably be much more interresting and enjoyable.

    Do remember, though, that none of them are Java, you have to forget the Java way and "get" the philosophy of those languages or you'll end up frustrated with very slow apps and bloated code.

  • by 5n3ak3rp1mp ( 305814 ) on Friday October 21, 2005 @11:47AM (#13844930) Homepage
    I know this is about PHP but as a long-time web developer, I'm sure a lot of other web devs will be reading this, so here are my observations on RoR.

    I've started my first small-scale Ruby on Rails [rubyonrails.com] project, having done work in the past in ASP, .NET and PHP. Here are some thoughts.

    1) RoR may be highly buzz-worthy but it is certainly NOT a panacea. It has a definite and slightly steep learning curve, especially if you are also new to Ruby and/or OOP and/or MVC (I am sort of but not completely new to all of these). You will still have to do the work of developing your application- you just won't have to do the "stupid" kind of work that much (repeating code in views, bubbling new database fields through umpteen app tiers to the surface of your app, hand-validating everything, building a mechanism to bubble errors or notifications to the surface, etc. etc.)

    That said...

    2) I can see that if I can get past the little syntactic things that are currently tripping me up, a lot of the RoR technology (and all the assistance its framework provides, once you get to know it... again, that takes time) helps to make web development a breeze.

    3) MVC [google.com] certainly seems like a pattern to seriously consider for anything other than a small web app. Mixing code in the presentation layer is not the way to go if you want easy unit testing, separation of view from code (so your graphic designers can go in and do their thing separately), arbitrary mixing of controller code with different views, etc.

    4) Ruby itself is a pretty great language to code in and highly readable. It has a few quirks (doesn't every language?) but if you are aware of them then they won't get in your way. Some of the things I like about it were apparently "borrowed" from Perl (as I never really got that into Perl). If you are not a static-typing purist, I'd say check it out on its own.

    5) Installing some Ruby/Rails components that depend on each other is not at ALL as painless as it should be on OS X. For example, I'm currently having issues with RMagick and GraphicsMagick even though I followed a guide [poocs.net] I found online, to the letter. I think the darwinports, fink, and rubygems people should get together and work some shit out, as all the different default paths these packaging/deployment tools install their stuff to causes mutual interdependencies to sometimes fail. I've also seen some MySQL issues that will require good troubleshooting to resolve, for some people- some of it is based on incompatibilities with GCC 4.0, or between the password hashes of different MySQL versions, or... Basically, this is all stuff that as a Rails scripter (as opposed to a C++ programmer) you wouldn't want to focus too much time on. If you want to know what I'm talking about just google "rmagick 'os x'" or "mysql rails 'os x'" and read up. That said, if you can get a good host [textdrive.com] with good Ruby/Rails support, you might not need to worry about such things... Unless you want to develop locally on that shiny Powerbook (grrrr). You better be a good troubleshooter, as Google won't get you out of EVERY bind!

    6) The people on the #rubyonrails IRC channel on freenode are generally helpful, but not at all hours of the day. It also helps if you put up small PayPal rewards to get someone to help you over those time-sensitive humps ;)

    7) Managers at big corporations (such as my employer) who have been out of direct touch with technology for a while will only tend to recommend the "usual big stuff"- in this case Java/EJB/Oracle, or .NET. I suppose this falls under the "Nobody ever got fired for recommending IBM" paradigm, but the si
  • Silly argument (Score:3, Informative)

    by pavera ( 320634 ) on Friday October 21, 2005 @11:51AM (#13844971) Homepage Journal
    Ok, I've been developing for 12 years now, and almost purely web development for the last 4. I generally use PHP for what its good for (page generation, presentation layer type stuff), and use xml-rpc or SOAP from php to connect to java, python, perl, or c++ whatever has the best libraries/capabilities/ease of use for what I'm trying to do. I've actually moved almost exclusively to python as my backend/business logic language of choice, but Java worked fine for this purpose 3 years ago too. To me, setting up struts, jsps, all that garbage is a ton of overhead that a simple soap/xml-rpc setup easily replaces (and in my experience php + soap/xml-rpc + languageX is faster than an all java setup). PHP then can do what its best at, my frontends are very lightweight, and load almost as fast as static html, and I use a real language for logic and libraries etc. Now maybe this new PHP Framework will provide some classes and things that would be useable on the backend, I dunno.

    The setup I use is basically the J2EE model, except I get the best of all worlds, because I can access code written in any language seemlessly, use n-tier architecture without even thinking about it, use advanced cacheing libraries available in the higher end/heavier languages, and because the backend code is running as a daemon running a soap or xml-rpc server, I sidestep the whole perl/python interpretter startup bottleneck.

    It's not about which language is "best" its about what tool gets the job done.
  • by Anonymous Coward on Friday October 21, 2005 @12:15PM (#13845188)
    I could say several positive things about PHP, but I think it wiser to point out some of its weaknesses. The presentation is a fairly geeky and technical based rant, so read if it works for you! PHP is fine for certain websites, but don't believe it's universally better:
    • No non-commercial debugger without paying Zend $$ (Perl, Python, and Ruby provide one for free).
      • For certain embedded or kernel environments, I can understand kprintf() mentality. For today's ample boxes and supposed modern languages I expect at least a rudimentary command line debugger.
      • For gravy, give me a good profiler for when the performance problem isn't with a backend database and doing it's tracing/diagnostics/explain plan mantra. NOTE: Strangely enough I've had more success in this area with PHP than for the debugger
    • Lack of well known tool of similar quality to Perl's (-w|use diagnostics) or pychecker to spearhead any of deficiences of using a scripting language over a statically typed language. Sorry more analysis than "php -l" for syntax errors would be of great benefit to PHP. If there is one that I'm not aware of since the last time I checked, here's your chance to educate more people on the matter.
    • Windows PHP/Apache stack seems very unstable on Windows compared to Linux, yet these two are the same respective layers in LAMP. Zend has a $olution and I have NOT tried FastCGI, so mission critical apps with high reliability don't seem to be really cross-platform. I'd be willing to pay ActiveState money before Zend, since it all seems about hooking people and selling the pot-hole patch kits.
    • Brain dead basic library design, until Pear remedies (in some cases):
      1. Why doesn't variable interpolation within an HTML page do htmlspecialchars()?
        • Most cases need this behavior, let's make the opposite the default!
        • Making the hacks and the couple of legitimate cases call a function to not do the expansion would make too much sense, we can't cause any minor backwards compatibility problems, especially when we would have to admit to one of our mistakes. Far better to claim there is some correct way for the application programmer to do that and that it is their fault, not ours.
      2. Basic language design promotes, but doesn't preclude, seperation of business logic and display, especially for lower-level developers who write code who others must maintain. Just read the default documentation assuming you're a beginner with nothing else. NOTE: yes, I believe that you are better off using one of the Pear Template Solutions for several reasons and getting a decent book besides the default documents (this advice goes double, if you happen to use Perl). Python and Ruby seem to have better documentation sources for learning the languages, IMHO.
      3. Most PHP DB interfaces are prone to SQL injection, because they do not promote the use of Bind variables. Proper DB quoting can happen at the proper place within the library instead of depending on application programmers to get it right all the time. This is the approach used by many other scripting languages (Perl DBI and Pythin DB API 2.0 come to mind).
      4. Alot of damn functions for PHP array, yet doing usorts() and other stuff doesn't allow one to keep a sorted array efficiently while still inserting items
        • Already tried using a PHP-user level implemented binary search
        • Some approaches work OK, until about 1000-2000 items then performance significantly decays.
        • Weasel statements about providing object-like facilties within the language, but not saying that it is an object oriented language. Heck I wouldn't want to be able to sort my "objects" without using a regular function now would I and efficiently at that?
        • Some sorting can happen at the DB level, if properly done. But some applications and algorithms require more capability in the host language.
        • Most other lang
  • Comment removed (Score:3, Informative)

    by account_deleted ( 4530225 ) on Friday October 21, 2005 @01:27PM (#13845891)
    Comment removed based on user account deletion
  • by Decaff ( 42676 ) on Friday October 21, 2005 @01:37PM (#13845977)
    Not a big fan of Java, slow,

    No, especially not server side. Reaches within a few % of C++ speed in well-established benchmarks:
    http://www.shudo.net/jit/perf/ [shudo.net]

    bulky,

    No. It can run within a few 100k on mobile devices. Non-GUI java apps can run in just a few MB.

    not user friendly.

    A vague term, which could mean anything.
  • by anti-trojan ( 741754 ) on Friday October 21, 2005 @04:54PM (#13847784) Homepage
    If I write a big PHP app, I want to keep the compiled classes in RAM or on disk for more speed, like I do with mod_perl or Rails. What is the *reliable* way to do this in PHP?? I think it might even be impossible, due to the massive dependence on a global namespace..

    I believe PHP accelerators (like the open source eAccelerator) do exactly that. But again, I am not a PHP expert.

Understanding is always the understanding of a smaller problem in relation to a bigger problem. -- P.D. Ouspensky

Working...