PHP vs. Java - which is better?
I have a former client that has a customer. This customer asked them - "so when are you migrating from Java to PHP?" So evidently this person has the impression that the next wave of web applications will be written in PHP. My former client has asked me to provide an answer for their customer. If I translate it, I think they mean to ask "what is different between Java and PHP and why should we use Java over PHP." Here are my opinions - please add yours as you see fit. I must admit I don't know a whole lot about PHP, except that it's widely popular among the Linux/Apache/MySQL crowd and that it's similar to ASP in it's lack of a MVC architecture (yes, I know about the PHP MVC project).
- I think Java is more of an industry standard, whereas PHP seems to be popular among hackers and hobbyists.
- Java provides better separation of layers - key for testability. PHP has all the code embedded in the page, so you have to run it through a browser to test if database connections work (for instance).
- Java is more scalable.
- More folks know Java and it's easier to qualify someone's Java skills. How do you test someone knows PHP? Is there a certification?
- More for-profit organizations use it.
If you're a Java or a PHP-lover, I'd love to hear your opionions (facts are always better). I'm going to point my client to this post, so keep it clean.
Posted by Layton on August 22, 2003 at 11:23 PM MDT #
Posted by Damien Bonvillain on August 22, 2003 at 11:44 PM MDT #
Posted by Chris Davies on August 23, 2003 at 12:50 AM MDT #
Posted by rich! on August 23, 2003 at 01:15 AM MDT #
I do agree that Java provides for a much greater seperation of layers, although there are some neat templating systems for PHP (Smarty, for example). JSP with taglibs is OK, but Struts/Webwork/etc/etc provide fantastic architectural support. Even with extensive use of PHP's object model, you are still tied to scripts (which you can include and reuse, but it gets messy reasonably quickly). With proper seperation, testing in Java is a breeze. I use Webwork, and I can test Actions with JUnit directly from Eclipse. I test my data tier directly as well. I can't see how you can test PHP outside of the server environment (unless you move to command-line PHP interpreter?)
Scalability is a whole other f*cking can of worms. Yahoo selected PHP for their systems, other companies use Java (parts of eBay, Dell). Any system (within reason) can be made to scale ... I have scaled ASP/VBscript on IIS. Get some routers, buy a bunch of web servers and the biggest database you can afford.
Testing developer skils is a challenge regardless of the language. Certification is no real indication of expertise, just an indication of passing an exam (and keep in mind that if you get 50% and pass, it is also another way of saying that you know HALF of the subject material) . I cannot comment on the numbers of developers, but in my experience finding quality Java people can be a challenge (finding people who have touched Java is easier).
Personally I think that language is just one of the many factors that need to be considered when desiging a system, and they should be subsidiary to the business case.
Posted by Toby Hede on August 23, 2003 at 01:25 AM MDT #
Posted by No one on August 23, 2003 at 02:02 AM MDT #
Toby and "No one" are both correct. One of the things that "No one" missed was that the install base of PHP on webhosts is HUGE. Far greater than Java. I would like to add a couple of things that I have noticed from my experience with PHP and Java. I currently have two deployed PHP web applications that I have to maintain. I also have three java web application that I maintain.
PHP is such a head-ache that I would NEVER suggest to a client that a web application be written in PHP. "No one" is correct about installation. If you don't have PHP installed with Apache, you are in for a long ride. Nothing can beat the installation of Orion. Unzip. java -jar orion.jar. Instant Java Web App.
Database access has not been standardized. Every database has its own set of functions, and they are not always named or perform the same type of functions. Oracle's functions are so different it boggles the mind.
PHP has OOP, but it is not like any other OOP I have ever used.
PHP's XML support is antiquated. No JDOM for PHP.
PHP is a mish-mash of functions that have been thrown together in one library without any care given to convention or standards. Just check out the number of functions that have been written for arrays: Array Functions and notice that some begin with array_ and some don't. Session handling in PHP is a real pain as well.
PHP does have a couple of pluses. It is easy to learn. The documentation is good and in one place. There are a bazillion scripts that are already written. There are a bazillion web hosts that already have it installed.
Can things be done "correctly" in PHP? Yes. But once your developers learn how to do things correctly, they will be asking for Java. When they overload a function, they will not want to count the number of parameters that were passed to determine which function should actually be called. They will tire of trying to avoid the circular includes. They will tire of the constant ftp to the server to test out the latest changes. And they will want a real IDE.
I suggest using PHP to learn the fundamentals of web based applications. Use Java to actually build systems.
Here is an article discussing why a largish hardware site switched from PHP to Java. It disusses the virtues and vices of Multithreaded (Java) and Multiprocess (Apache/PHP) systems.
Posted by Carl Fyffe on August 23, 2003 at 02:55 AM MDT #
Posted by Marc Adams on August 23, 2003 at 03:49 PM MDT #
Posted by Ale Sarco on August 23, 2003 at 09:08 PM MDT #
Posted by Joshua Hoover on August 24, 2003 at 04:29 AM MDT #
Posted by csshsh on August 24, 2003 at 04:38 PM MDT #
You can isolate a class of web "applications" where you feel that Java is overkill, PHP fits this niche.
Posted by Damien Bonvillain on August 24, 2003 at 08:51 PM MDT #
Posted by Adam Vandenberg on August 25, 2003 at 07:42 PM MDT #
Posted by Olivier Rossel on August 26, 2003 at 01:09 PM MDT #
Posted by Damien Bonvillain on August 26, 2003 at 10:14 PM MDT #
Posted by Paul Rivers on August 30, 2003 at 01:30 AM MDT #
Posted by Dianne Schoenberg on August 31, 2003 at 01:23 AM MDT #
Posted by Dhananjay Nene on September 03, 2003 at 07:49 PM MDT #
Posted by Oliver Tseng on September 12, 2003 at 03:27 PM MDT #
Posted by Michael on October 28, 2003 at 03:14 PM MST #
Posted by bubba on March 25, 2004 at 05:11 AM MST #
Posted by kok koon leong on May 07, 2004 at 05:35 AM MDT #
It addresses many of your gripes about PHP in respect to Java. that leaves you with a very rapid development language and still logical code-reuse and seperation of layers.
It also have a component event cycle similar to .NET which provides a very simple suggested coding standard.
-Jackson
Posted by Jackson on July 16, 2004 at 09:14 PM MDT #
Posted by Nick Parca on September 29, 2004 at 07:04 PM MDT #
My primary focus includes scalability, true object orientation and performance. Other factors: We are currently all MySQL but want to migrate to Oracle, we see anywhere from 30-80K surfers per day depending on the season, and I must create an upgrade path that blends in with the existing system - I will not have the luxury of a "Next Release Cutover" scenario. All communication is performed between systems via HTTP with XML as the interaction language - that being said, I still need to communicate with a variety of other systems using and equally wide variety of protocols (merchant processing, currency conversion, GeoIP et al...). There are no proprietary forms/apps/methods that talk to the system, everything is done via HTML. As an aside, I would REALLY not like to go to two languages, provided I can do this without breaking my "Best tool for the job" ethos. Any coder worth his/her salt can learn a language/framework given some space, so the ramp up time is considerably less important than the result (Frankly, I think the zealotry in several previous posts demonstrates more about one-trick-pony coders than architecture and framework effectiveness).
My immediate experience is that a Tomcat/JBoss deployment has a bunch of overhead that seems to be less than exciting from a performance perspective, but I am concerned about PHP systems not being built from a class hierarichy (I love the Delphi model where everything decends from TObject...). I would really enjoy seeing both a Java and PHP expert argue why I should go with their platform. Clearly, Yahoo and Friendster think that PHP is the way to go, but the list of J2EE folks is getting huge.
Thanks for the space,
-EP</font>
Posted by Ed Purkiss on December 09, 2004 at 05:39 PM MST #
I think you can equaly use php an java for the same purposes. You can create extensive applications with both php and java. The whole problem is the reputation of php. Sure there are things you can't do with php and surely that works two way's
Currently i am developing a php framework in php5 that is completely class based and communicates only using xml. Php CAN be used to make very clean, reusable and maintainable software BUT the level of dicipline needed to do that is WAY higher than needed when useing java. The rules you must set for oneself are harsh and you must abide by them strictly otherwise your php app wil degrade very fast into a bunch of scripts that are not very usefull.
Posted by Quinn on December 16, 2004 at 02:39 PM MST #
Posted by Michael Clayton on January 25, 2005 at 10:34 PM MST #
I'd like to comment on Permalink's original article:
>>I think Java is more of an industry standard, whereas PHP seems to be popular among hackers and hobbyists.
This is not a reason to do anything. Don't do stuff because others are doing it, that's for lambs. Do what you must. In fact, choosing technology X when your competition is using technology Y might be a competitive advantage (or it may be a fatal flaw - depends on what are you choosing over what).
>>Java provides better separation of layers - key for testability. PHP has all the code embedded in the page, so you have to run it through a browser to test if database connections work (for instance).
True to some extent, but that depends more on how do you design your PHP-powered system. If, for example, you keep all your database abstraction layer separate, you can test separately.
You can also use Smarty or other template systems to completely separate code from display, so you can have programmers write PHP code and web designers write HTML/CSS, change look or behavior separately, etc.
>>Java is more scalable.
Not true. Java applications tend to be state-based. PHP applications are stateless. It's far easier and cheaper to set an array of very cheap (even second-hand!) PCs running Linux+PHP, than Java clusters. PHP is scalable right-away, you don't have to design your applications to be so!
>>More folks know Java and it's easier to qualify someone's Java skills. How do you test someone knows PHP? Is there a certification?
There are PHP certifications, check out Zend's website. Java is, indeed, more widely known (although this is changing), but PHP is ridiculously easy to learn as opposite to Java. Besides, any Perl programmer will have it very easy to learn PHP, and Java/C/C++/C-like language programmers already know the syntax.
>>More for-profit organizations use it.
See my first comment.
IMO, Java will be better (and perform better) for very large applications, but elsewhere, I wouldn't doubt using PHP, for the following reasons:
1. It's far more productive than Java, and I mean far more. What it takes 10 hours to develop in Java, you can easily do in 1 hour in PHP. Time is money. This alone makes me like one language over another.
2. It follows the KISS principle, as opposite to Java which tends to produce bloatware and blOOatware.
3. This is part of the reason for points 1 and 2, but it deserves special mention: the PHP APIs are simple and productive, unlike Java's blOOated, cumbersome, needlessly complicated APIs. It's so overgeneralized you can't do anything quickly. It pretends to solve so many problems it doesn't solve anything easily. You can't possibly memorize all that and be productive with it. Think parsing a URL. In Java you have to create a new object and call methods with illogical names to do it. In PHP, all you have to do is call ONE function - parse_url - then simply access whavever you want as a hash, using the names you actually know and use everywhere, like port or host.
4. It's cheaper. Any cheap Celeron with 100% free software will be a great PHP server for a site/web application with tens of thousands of hits a day! As you need more power, scalability will be cheaper and simpler too - but there are few things a dual Xeon with PHP won't take! PHP can be ridiculously fast for small to medium-large applications in real environments.
Posted by Wiseman on May 15, 2005 at 03:22 PM MDT #
Posted by liam on July 20, 2005 at 02:34 PM MDT #
Posted by Labros on May 03, 2006 at 01:42 AM MDT #
PHP is pretty damned easy to install.
1. Install Apache
2. Install PHP with the windows installer
3. Add PHP's apache configuration lines. All 3 of them.
4. Restart apache.
Database access is now standardish. You have PDO (PHP Data Objects), PEAR::DB, and Zend_DB. Any of these options allow you to connect to any kind of database and go.
PHP has OOP. PHP doesn't (yet) have namespaces. It fits very well, barring that.
PHP now has SimpleXML. XML in PHP is easy.
A few other of Carl Fyffe's comments niggle me.
> They will tire of trying to avoid the circular includes.
PHP has had require_once, include_once forever. If you don't know about those, you haven't RTFM.
> They will tire of the constant ftp to the server to test out the latest changes.
It's too hard to set up your own apache + php installation? Four steps!
> And they will want a real IDE.
Maybe. I can't stand the damned things. My coworkers all use Zend Studio, and it's alright. The only thing it gives you is the ability to tab complete, and shorthand code completion. The rest... well the rest can be done with a decent text editor and a collection of command line applications. PHPUnit, ZendCodeAnalyzer. Doxygen.
The beauty of not using an IDE means you stay focused, your functions/classes/methods HAVE to be easy to remember and make sense, and if you don't KISS you dig your own grave. PHP used like that results in a very handy tool.
Posted by Daniel O'Connor on August 24, 2006 at 07:05 AM MDT #
Posted by someone on October 20, 2006 at 09:11 PM MDT #
Posted by DHIRAJ PATRA on November 30, 2006 at 09:21 AM MST #
Posted by david on December 03, 2006 at 08:44 AM MST #
I think Java and PHP are for different things. I have been a Java programmer since 1997. I do coding on my job and make a living with it. Recently, I wanted to create a website for kids' math, I couldn't find a good open source java package for it. I searched on the web and found there are many good open source PHP packages there that may be good for the purpose.
I spent a month (a couple of hours each day) on creating www.mathpotd.org with Drupal. I think Drupal is well suited for the job. I don't believe I could do it in Java.
Java may be just for so-called enterprise applications -- companies hire high paid Java programmer for their good or bad systems.
Posted by Paul Z. Wu on December 04, 2006 at 07:34 PM MST #
Posted by kiran on January 09, 2007 at 12:00 PM MST #
Posted by Man'z on January 16, 2007 at 08:08 AM MST #
Posted by MG on February 06, 2007 at 05:07 AM MST #
Posted by me on May 24, 2007 at 01:13 PM MDT #
Posted by peter_kosmas on September 04, 2007 at 01:11 PM MDT #
Posted by Lox on September 12, 2007 at 12:44 PM MDT #
Posted by bluejay on September 18, 2007 at 10:24 AM MDT #
Posted by Amir Ali Tayyab on October 10, 2007 at 08:24 AM MDT #
Posted by Madis on October 16, 2007 at 03:58 PM MDT #
Posted by David Hill on October 26, 2007 at 05:59 AM MDT #
Posted by Iwan on November 04, 2007 at 09:58 PM MST #
I'm migrating from J2EE to PHP, I think PHP is:
- more scalable;
- more simpler and fast;
- fast to develop;
The customers always ask to make a site with good performances, and java is not the right choice.
Posted by mike on January 22, 2008 at 10:20 AM MST #
The truth is: many people using php don't have any clue about java and many people using Java don't have any clue about php but both are quite the same in a web context with a few things that make them more liked in different situations.
I personally believe as i'm a php guy that php is a much better choice for any web app/site needs, just because it has been a great part of my experiences while the few experiences i had with java were about highend big company webapps built in the early 2k. I'll try to say a few things about what i know better, wich is php:
-php isn't a pure oo language, wich imo is the main reason why many php apps are faster than any java concurent (because java object model and framework is so rich that it's just oversized as a response to web's small needs)
-php let the developpers do as much mistake and design errors as they want. This is actually a big advantage because it also means it's easier to learn for the beginners and that doesn't means that an experienced developper will engineer a bad an lacking performance or maintenability code.
-php offers a response to most of the needs one can have. Including offline and asynchronous tasks and permanent session (that would be with some work done with the operating system but still it's not a really hard thing to obtain) as i see it those 2 are the main reasons for an enterprise to go the java way in a web based application.
-php is widely available and used over the web, much more than java and increasing, there isn't much more to say here that's just a fact with natural consequences to expect.
Now as i see it, java has been created to handle domotic needs in the first place and still is a common used language in many industrial companies, like cars etc, that isn't imo a domain php is suited for, even for traditional heavy client market java is much more used than php will probably ever be. Php has a big advantage on the web mostly as it is used in apache as a module zeroing any VM launch time, but in any other context Java and php both take time to run comparing to any compiled program, as far as i'm concerned i see no problem saying java is better than php when it comes to anything but web things, i could mention tho, that there is a lot better than java there with C++ or C but that is another troll i guess :)
Posted by 41.208.139.136 on January 22, 2008 at 04:58 PM MST #
As you said...
* "I think Java is more of an industry standard, whereas PHP seems to be popular among hackers and hobbyists."
-- I believe Java is more popular among the industry who can afford high bucks. While PHP - Powerful Hyper Text Processor in my opinion is most popular among web-applications.
I personally used both Java and PHP for same web-application and found PHP processing the data much faster than anything else in near-by competitors.
Regarding security, I do not think anything Java, ASP or PHP can secure 100%, once door to internet gets open while connecting to World Wide Web. When no one can guarantee 100% security or bug-free version, why not to go for an open-source.
* "Java provides better separation of layers - key for testability. PHP has all the code embedded in the page, so you have to run it through a browser to test if database connections work (for instance)."
-- Not necessary, PHP codes do not require to embedded in the web-page. As PHP has choice between include() and require() function.
* "Java is more scalable."
-- Personally, I could not find anything PHP can not do that Java can do. But, as a matter of fact I could not found any Java based online shopping-cart application which is fast and popular.
* "More folks know Java and it's easier to qualify someone's Java skills. How do you test someone knows PHP? Is there a certification?"
-- PHP runs on Zend Engine, Zend offers PHP certification and Zend is founded by Zeev Suraski, Andy Gutman and Rasmus Lerdorf who invented the PHP.
* More for-profit organizations use it.
-- If we look at the statistics provided by third party, PHP installations on web-server keep increasing day by day because of more than one factor. The one factor is easy to learn. Syntax is very similar to C++ and Java programming. Plus it's really fast interpreted language.
Posted by SID TRIVEDI on February 11, 2008 at 05:42 AM MST #
Posted by rajeev on March 03, 2008 at 10:16 AM MST #
Posted by Ben on March 12, 2008 at 12:44 PM MDT #
Posted by prabhat on March 31, 2008 at 11:38 AM MDT #
Posted by maharba on April 02, 2008 at 01:07 AM MDT #
Posted by random on April 24, 2008 at 08:43 PM MDT #
Posted by Manju chauhan on May 14, 2008 at 08:36 AM MDT #
Posted by Manju chauhan on May 14, 2008 at 08:37 AM MDT #
Posted by Manju chauhan on May 14, 2008 at 08:37 AM MDT #
Lots of *very* insightful comments. I will now add my own:
I drank too much Java. Now I have to PHP.
Goodbye, you self-serious clods!
Posted by all i know on May 23, 2008 at 08:30 PM MDT #
Posted by Extenders on August 11, 2008 at 07:25 AM MDT #
Posted by Bob on August 12, 2008 at 02:59 PM MDT #
Posted by raj on August 17, 2008 at 05:18 PM MDT #
Posted by raj on August 17, 2008 at 05:19 PM MDT #
Posted by raj on August 17, 2008 at 05:20 PM MDT #
Posted by raj on August 17, 2008 at 05:31 PM MDT #
Posted by adwin wijaya on September 17, 2008 at 11:12 AM MDT #
Posted by adwin wijaya on September 17, 2008 at 11:15 AM MDT #
Posted by Nehatha on October 16, 2008 at 10:30 AM MDT #
PHP programmers are by far the worst programmers of all. No other programmers have the capacity to produce gazillions of terribly mediocre script as PHP programmers do.
Fact2:
PHP is easy to learn. That's its streagth and in there lies its weakness too. Because every hippy with a notepad can write php code and get instant gratification of being able to echo out HELLO WORLD in a minute or so.
IT also means these same hippies are the ones who after writing few extra lines of code consider themselves programmers and start up their own blogs to share their knowledge of PHP via tutorials and scripts and litter the internet with criminally mediocre code.
There's nothing terrible than seeing a whlole page being bulit with PHP ECHO statements.
eg. echo "<HTML><HEAD>.......". And that's exactly what hippies do when they realise they can use PHP to actually output html too. U see, hippies are not aware of the benifit of separating applications into layers for managebility, maintainability and flexibility. Hippies do live in their own world u see....
Fact 3:
Zend framework is crap. there I said it.... And it comes out of a company run by the inventors of PHP. Though I tried so many times, I just can't seem to bring myself to use it....
Fact 4:
In fact pretty much all PHP frameworks are crap.
Fact 5:
Pretty much every JAVA frameworks suck too. :-)
Fact 6:
All the improvements that gets put in new releases of PHP is just a catch-up game with JAVA.
Fact 7:
Any language that doesn't have native support for namespace is a language for amateurs :-)
Fact 8:
PHP can't do everything java can, not by a long shot. Multithreading ?? hello! Try writing an applet :-)
Fact 9:
I like Java and I like PHP too. But if someone tries to tell me PHP is better than java or PHP is inpar with java , I always beg to differ. Its like comparing a bicycle with a car..... not quite but close :-)
Fact 10:
Netbeans has released a FREE IDE for PHP. Its got all great features like code completion, syntax highlighting, marking of occurrences, refactoring, code templates, pop-up documentation, easy code navigation, editor warnings, a task list, as well as a debugger. F
Fact 11:
Netbeans is a product of Sun Micro Systems. Yes, hippies, that's right, they are the folks that gave you java and now they are trying to turn hippie PHP programmers into real programmers by providing a productivity tool with a standard project structure and heaps of goodies to make PHP software development so much better.
Fact 12:
Zend IDE from the hippies that brought us PHP is a commercial tool. and even then it sucks big time. I haven't even started on the commercial Accelerator that Zend provides to speed things up in PHP, and why greed is a bad thing for hippies and why such greed only harms the cause og PHP as a language.
Fact 13:
FACT 11 & 12 point to the fact that java community is making a greater contriution to PHP than hippies that run Zend.
Fact 14:
Netbeans PHP IDE is the best thing to happen to PHP programmers after sliced-bread.
Fact 15:
If you don't like Netbeans PHP IDE, u r a hippie!
Fact 16:
: I have to admit , I like PHP too. I program in both languages and I can switch languages with equal ease. Not just that I use combination of both sometimes to get things done. And both java n php programmers might find it horrifying but I like JavaScript too. I like to write language agnostic web applications. I use a lot of javascript and good database domain model. If you have a rich set of javascript library and a well designed database model, server-side language merely acts as a service layer.....and I can throw away PHP and use java when I need java's power and flexibility, without rewriting my whole application.
Posted by anjan on October 22, 2008 at 02:42 AM MDT #
Posted by Gabriel on November 06, 2008 at 07:02 PM MST #
Posted by anjan on November 14, 2008 at 12:36 AM MST #
Thanks to all of you for your contributions (except for the very few that are obviously jerks).
Java vs PHP is a debate that is here to stay, the reason I am looking at this page is that I got sucked in to a large Java project and I have found it absolutely incredibly hard to do stuff that in php is quite simple. mysql_fetch_array in php for instance, vs no such thing in java, unless I've been looking in all the wrong places.
I've done a lot of programming, from assembler to C, php, basic and a whole slew of other languages but I do not remember anything quite as 'verbose' as Java code, it looks like classes are endlessly repeating chunks of code that are handled quite easily by utility functions in other languages but which are either not present in java or nearly impossible to implement. Portability seems to be another issue, switching from 'resin' to 'tomcat' caused all kinds of build issues, changing a single class and redistributing it requires a server shutdown and so on.
I'm sure I'm still doing lots of stuff 'wrong' from the java point of view but I have a feeling that PHP has improved a lot in the last few years whereas java has more or less stood still when it comes to doing web development.
I'll keep revisiting this thread from time to time to see what else comes up, it sure has been an interesting read.
And now back to java coding :(
j.
Posted by Jacques Mattheij on December 28, 2008 at 11:03 PM MST #
Posted by Cifar24 on January 25, 2009 at 08:45 PM MST #
I purely agree that PHP will be the language of next gen for web development. I've been a hard core java developer for years but now i'm designing a site for which i had to learn php. After building few pages with php i've seen there z a lot of reduction in development time compared to that of java and php is faster than java at times.(NO vm required for php)
In terms of scalability php scales more than java. (Read it in a recent study article published by the architect of XML and co-founder of OpenText). Java is next to php in scaling, but yes maintaining php files is a bit confusing than java packages. Until or unless you aren't developing web apps for a company which has its own dedicated server and own resources i would preferably say php will be a better choice.
Posted by Kailashnath on February 16, 2009 at 08:36 AM MST #
Posted by Raja S Patil on April 17, 2009 at 09:13 AM MDT #
Posted by Ryan on April 19, 2009 at 02:48 PM MDT #
Posted by Ryan on April 19, 2009 at 02:49 PM MDT #
Posted by Ryan on April 19, 2009 at 02:51 PM MDT #
It is possible. Java have the syntax to do that.
-- Also, it's fast to develop in. Whereas in J2EE, you'd have to compile, deploy, wait for JSP to compile (if you didn't precompile them beforehand) and then you can test it
Check out "Sysdeo Eclipse Tomcat Launcher Plugin" or "MyEclipse Plugin".
-- It took me some time to figure out how to use servlets and jsp but only a few minutes to hack out a php script.
If you compare just PHP script with JSP script, then the learning curve and will just be the same. And with the extension lib from Apache Commons Lib, it will be as easy to use JSP as PHP. http://commons.apache.org/components.html
-- Java has a slow start up and requires more from the client's computer, as php is server side only and gives client a maximum ease of access
Hi, I think you miss the point. Both J2EE and PHP are use as a server side programming and sends only client side codes like html and javascript to browser. Most people here did not mention Java applet as it is mostly use as a heavy client purpose.
-- php isn't a pure oo language, wich imo is the main reason why many php apps are faster than any java
Sounds logical. But does that means anyone who use OO in PHP5 will experience slower response that is comparable to Java?
Posted by Ryan on April 19, 2009 at 02:53 PM MDT #
Posted by pankaj on April 20, 2009 at 09:04 AM MDT #
Posted by Shah on May 30, 2009 at 03:49 PM MDT #
Posted by Shah on May 30, 2009 at 03:50 PM MDT #
Posted by Shah on May 30, 2009 at 03:51 PM MDT #
Posted by Tadas on November 30, 2009 at 04:56 PM MST #
Posted by kirk bushell on March 19, 2010 at 12:50 AM MDT #
Posted by rakesh on April 20, 2010 at 03:50 AM MDT #
Posted by Ali on April 23, 2010 at 10:30 PM MDT #
Posted by Ali on April 23, 2010 at 10:31 PM MDT #
Posted by Ivan Ganev on May 03, 2010 at 08:06 AM MDT #
How you can compare the Hypertext Preprocessor with a compiled language ? So your next comparison should be: JavaScript versus C++! which one is better for web apps?
So the Java is to develop any cross platform application. The PHP is to develop websites.
Yes, you can do websites using JAVA as you can walk on the beach wearing ski boots :)
I worked for one big company for 6 months so I'd say: that company is developing lot of webapps or websites and all of them using JAVA,why? because they can hide the code against customer, even the client can decompile the app cannot re-use simple way. And as far I remember it was painful for us and almost everyone asked: why not in PHP?
The funniest was: the company website was written in PHP ;)
Posted by daniel on May 07, 2010 at 10:52 AM MDT #
Posted by Matt Raible on May 07, 2010 at 04:28 PM MDT #
Posted by Yogesh on June 14, 2010 at 05:00 AM MDT #
Posted by Anirudha on August 19, 2010 at 12:02 PM MDT #
Posted by Anirudha on August 19, 2010 at 12:02 PM MDT #
Great comments, its pretty easy to identify the PHP'ers who don't really have the capacity to understand true application requirements.. And you Java guys who hav't really used PHP commercially, just glossed over the feature list, you ain't much better comparing the two.
But I can honestly say I'm qualified to make a point. 10+ years exp biulding internet apps of ALL types, started with PHP4 back in the day, built many an app, and administration system (50+). PHP was fine while the job was small.
Then evolved into Java which is now the bread and butter. Built real apps, multi-tiered, distributed, cached to the shit for some of the bigger brands in the country. And it is the shit.. if the client wants it, it can be done in Java.
But I'm not gona pointlessly highlight pro's and con's of each. They're both bloody good at what they do, which is why so many of you are red-faced defending your babies... as you should.
However the question is, which do you recommend to the client?
Well... the answer is... WHAT ENGINE OF CLIENT DO YOU HAVE?
Both will do the job, BUT, if your client is a notorious tight arse who bitches and moans with every cent they spend irrelevant of the bigger picture, and the job isn't massive, go with PHP. You'll be able to get dev's, and if they are half descent occasionally will deliver on the promises they gave with naive arrogance.
But if the client is willing to invest, has realistic expectations, has priorities squarely focused on long term goals, and has hopes to build on their investment over time, go with Java. By commiting to Java you're generally agreeing to a more structured approach, not just in code (which for a few of you clearly still think is all that matters), but also a more structured build process, with some sort of actual methodology, architectural consideration and design phase, documented requirements and signoff points.
And the end of the day the client needs some sort of assurance before the nerds start bashing out code, whatever language they choose. So make sure whoever you hire is not the sort of amature that spends all day on forums blindly defending the only programming language they know!
Posted by ExperiencedDude on September 02, 2010 at 03:42 AM MDT #
Posted by OneComment on November 11, 2010 at 04:14 PM MST #
HipHop for PHP transforms PHP source code into highly optimized C++. It was developed by Facebook and was released as open source in early 2010.
HipHop transforms your PHP source code into highly optimized C++ and then compiles it with g++ to build binary files. You keep coding in simpler PHP, then HipHop executes your source code in a semantically equivalent manner and sacrifices some rarely used features – such as eval() – in exchange for improved performance.
Facebook sees about a 50% reduction in CPU usage when serving equal amounts of Web traffic when compared to Apache and PHP. Facebook’s API tier can serve twice the traffic using 30% less CPU.
https://github.com/facebook/hiphop-php/wiki/
http://en.wikipedia.org/wiki/HipHop_for_PHP
Posted by 121.97.136.228 on April 22, 2011 at 02:12 PM MDT #
i would suggest you to check following pdf for your answer
http://www.cs.montana.edu/~tosun/phpvsjava.pdf
Posted by mack on April 11, 2012 at 12:59 PM MDT #
To quote the last comment "i would suggest you to check following pdf for your answer"
http://static.zend.com/topics/0200-T-WP-1107-R1-EN-PHP-is-not-Java-Seesions-in-PHP.pdf
After doing my own DD, I beleive both (specifically HipHop vs EE) have there applications and it depends on the requirements of the application. I dont think any one in the EE camp can argue with the scalability of FB, just as anyone else can argue with the maturity, security, & distributed architecture with application persistance that EE has and is the backbone of Amazon. I believe that the two together can do some real magic depending on the application requirements.
Although, i have to say it, PHP is more applicable to Agile Projects, you can hit the ground running with rapid prototyping...
But good grief forbid even the thought of re-engineering/implementing any EE code into php!
Posted by DG on November 08, 2012 at 05:50 PM MST #