Why is PHP Popular?
April 27th, 2004Harry writes about MySQL as a disruptive technology, suggesting that PHP is a disruptive technology. He dredges up an old Sitepoint post of mine on how PHP is good enough software.
The summary being that software that values simplicity over everything else propagates faster.
Mike Cogan doesn’t understand why LAMP and especially “uncomfortable” PHP should be more popular than “nice neat” Java on various freelance sites. He thinks that the users of these sites, typically smaller businesses, are being short sighted in their choices. perhaps not.
One thing that PHP has is a market of excellent packaged end-user oriented software for websites: vBulletin, oscommerce, x-cart, pMachine, ez-Publish, gallery, phpBB and php-nuke, plus other hosting control panel favorites. These are the killer apps that drive PHP. End users ask for them by name and look for places that host them. End users also install the free open source PHP packages available in their hosting control panels. They pick cheap LAMP hosting, then later ask their host or go on the freelance sites looking for custom programming or installation.
The Hotscripts.com Java ad management software category has 4 entries, one sponsored costing $699. Meanwhile, the PHP Ad management software category has 105 entries, three sponsored all less than $100. If you were a small site owner looking to choose a platform for your site, which do you think it would be short sighted to select?
If you were a small software developer creating a web based software package for sale at a price point less than $250, which platform would you pick to maximize your potential market?
Cogan suggests that selecting PHP would mean that it would be “difficult to integrate any other future business solutions.” But this isn’t true if your future business solutions are also PHP based, as is likely to be the case for small sites.
There is a network effect that drives end user demand for PHP. Each new killer app available on PHP makes the whole platform more attractive, which draws in new apps. The whole cycle will draw in more and more PHP programmers.
Cogan also suggests that PHP solutions would be unmaintainable, unscalable, and unprofessional. I disagree. I think these qualities have more to do with the programmer than with the language.
I think Cogan’s attitude may be typical of the MIT Approach that seems to prevail in the java culture. Zend should take note of this. The road into the enterprise is an uphill battle, fighting against the MIT attitude all the way. Instead, Zend should do everything they can to grow the commercial PHP small business/consumer web application market.
This means installer technology and including a compiled byte code distribution format in standard PHP so that companies can distribute and sell PHP applications without source code. Sure, they would commoditize the market for their cache and encoder products, but they would lock up the small business/consumer market, which is where the benefits of PHP lie. An increased commercial market would create new opportunities. Eventually, the economics will pull in larger and larger businesses.
The doorway into the enterprise for PHP is economic, not technical. Pushing PHP into the enterprise through the IT department is a losing game. Pulling PHP into the enterprise through the end user is a wining game.
Anyway, I think the network effect has already “tipped” for PHP in the consumer/small business marketplace with or without Zend.
PHP IS a disruptive technology.
One last thing, Bill de Hora has a technical reason why lamp hosting is more cheap and plentiful than java hosting.
April 28th, 2004 at 2:09 am
On that technical note, Rasmus Lerdorf makes a similar point here on PHP being a “shared nothing” architecture. Because nothing is shared between requests, you have to try pretty hard to “kill” PHP - bottom line is less maintenance effort for hosts.
April 30th, 2004 at 3:02 am
that does not show why php is more popular than
perl:
print ‘hello world’
python:
print ‘hello world’
and ruby
print ‘hello world’
April 30th, 2004 at 7:50 am
Java is for propietary companies who want to make lots of money.
1. You have to pay someone, almost everytime java gets an upgrade, to rewrite the code with new functions
2. If yiou find a bug, you have to get someone to fix the bug (not yourself)
3. You have to own a server with 2-4GB+ memory, which is will use entirely
PHP is for everyone else
1. There are many resources for getting php code, and the php website contains all the functions with examples
2. you can rewrite, reuse, and repurpose the code easily
3. You can integrate it with apache2 running ssl very easy
4. very easy to pick up programming it
5. it runs on the command line as well (great for testing)
6. you don’t need an IDE to program it
7. embeds right into standard html code
8. runs on a server with 256MB of ram
9. if php upgrades, and they do change the functions (php 3.x -> php 4.x), you can fix your own changes
Why wouldn’t you want to use php?
April 30th, 2004 at 8:05 am
I won’t use PHP because it doesn’t allow me to do the clean separation between layers that’s possible with ASP.Net, J2EE, AxKit and so forth.
For example I can code a web application in any of the above technologies where the web pages are just XML tags
with the business logic kept inside libraries. And have libraries of tags to use in the web pages.
Sure I can do this in PHP but doesn’t feel so clean.
Maybe I’ve been too much time in IT working with big companies, but I don’t see much value in PHP compared with the technologies refered above.
April 30th, 2004 at 9:24 am
A few comments to the comments:
1) PHP changes just like Java changes. A simple example would be the tiny “shout” application called “OnlyShout” (I don’t have the URL handy, sorry). It’s tiny, but I still needed to dink with it to get it to work with my version of PHP (4.2? It’s been a while). A stupid, simple example, yes, but it illustrates my stupid, simple point that PHP can be an organic language just like Java.
2) You can have multiple JREs on a system at the same time and easilly tell your Java apps which one to use. You can even execute deprecated methods with newer JREs (at least I’ve been able to). So, an upgrade to Java doesn’t necessarily mandate re-writing Java code.
3) You don’t need an IDE to write any code in any language, period. That includes Java.
4) There are paid PHP programmers, too. There’s nothing about writing PHP that mandates that it be done free of charge.
5) Depending on the software you’re writing and depending on your level of knowledge of OOP, Java can be a very, very easy language to pick up. For things like SOAP it may even be one of the easiest (I haven’t worked with SOAP in PHP yet so I can’t comment on that).
6) Sure, PHP can run with less RAM than Java/J2EE. However, if there’s an existing J2EE infrastructure, adding servlets is easy and is very efficient.
7) I’ve interfaced with MySQL in both PHP and Java apps. It’s all sixes to me. Neither seems any more difficult or inefficient than the other.
9) Java embeds within HTML code, too. Check out JSP (Java Server Pages) technology for more details.
10) Using mod_webapp, you can integrate Java/J2EE/Tomcat/whateveryouwannacallit easily with Apache as well. In the case of Tomcat, it’s part of the Apache project just like PHP is. I don’t consider one to be more difficult than the other.
11) Java is a programming language. You can get the development tools for nothing. You can get servlet containers for nothing. You can re-distribute JREs with your apps — even the javac compiler, if I recall correctly — for nothing. The decision to make money off of Java development isn’t linked to the language any more than it is with PHP.
12) If you’re basing your programming language preferences on how many lines it takes to print “Hello, world” on your monitor, perhaps you need to try developing larger applications. Java may require more lines to print “Hello, world,” but what that says about the power, ease of use, or quality of the language is beyond me.
13) Why can’t you debug Java apps from a command line? I haven’t had any problems, but perhaps I haven’t been writing the same kinds of applications.
Having said all of that, I do like PHP a lot and have every intention of using it in the future just like I have every intention of using Java.
May 1st, 2004 at 2:09 pm
Why is PHP so popular?
PHP has been written from day one with hosting in mind. For a web hoster, it is very easy to deploy mass hosting servers with PHP on it, and they have done this on a very large scale. One german internet hoster at one point in time had a single 28 CPU SUN E6500 hosting more than 2 million domains on it. That’s two million more domains with PHP available, and simply because it is there, it is being used. Today in Germany you are hard pressed to find a hosting service at any scale or rate that does not offer PHP.
Same goes for MySQL: MySQL is a database server that was good enough for 80% of the market, and was optimized for a very small memory footprint. MySQL behaves well when deployed on the same machine as the web server, and it plays nicely with many logical databases on the same physical server.
Both PHP and MySQL quickly grew to include additional features that are advantageous in a shared hosting environment such as run time and memory limits or query rate limits.
Compare this to the average Java deployment environment and the requirements for such an environment, or try to construct a shared hosting deployment based on Java and, for example, Oracle.
The second very large factor working for PHP is the very flat initial learning curve. For many, PHP has been the first programming language, ever, just because it came with the hosting contract. And how do you write “Hello, world” in PHP?
Well, you create a HTML page containing the words “Hello, world”, and rename it to have a “.php” extension. The fact that every valid HTML page is also a valid PHP program means that PHP has zero initial learning curve.
From here, people start by adding simple PHP tags and exploring things. Just save from your web editor to your remote FTP location and reload in your browser. No compile-link-deploy cycles, no delays, just instant feedback. A simple “echo $currency*$rate” strategically inserted into a self-submitting form, and you have just written your first online currency converter. Three more commands, and you get $rate from a MySQL database. Simple things are easy in this world, and people can concentrate on understanding stuff instead of learning existing classes, frameworks and models.
This is how people learned with BASIC, and this is how they learn PHP. Using PHP, people solve their problems and learn things like “variables” and “control structures” on the fly by experiencing them and by experimenting with them. Other, more complex concepts such as dataflow and input validation, SQL, ER-models and normal forms, classes, inheritance and refactoring follow just as easily…
Widespread availability due to easily available shared hosting and a smooth learning curve combined with acceptable applicability to a wide range of problems is what made PHP the killer language of todays web.
May 1st, 2004 at 6:53 pm
Kristian, nice summary.
Fact is, PHP is fine for 99% of web-based apps.
May 4th, 2004 at 11:50 pm
This is in response to Paul Pinto’s comment that there is no clean separation of layers. There are so many ways to get your separation it’s almost laughable you made that comment. First, Jeff’s own WACT is almost exactly like you want from ASP.NET and there’ve been a few posts over at sitepoint’s advanced forums doing the exact same thing. Smarty is both easy to use and quick. You can use XSLT if that floats your boat.
Anyway, comments like these are just examples that you haven’t investigated the full power of PHP. I know the counter argument to this is that if it’s not straightforward then nobody will use it, but obviously people do. Also, how easy is it for me to get an ASP.NET development environment set up? rpm -ivh httpd, rpm -ivh php-4.X, and VI and I’m good to go with PHP.
I have setup tomcat before, and that’s not a walk in the park either but at least it’s free.
May 15th, 2004 at 6:15 am
Well, I’ll add my bit here too. Firstly, I started in Java by trying to disprove the hype (30% programming efficiency over C++). With 8 years of C++ under my belt, I fetl qualified to test it (I know where you think this is going, but you’re wrong!). Java was more efficient and better than C++ by miles. Recent Swing enhancements have been pretty good too.
The new stuff in JDK 1.5 is fascinating. Most of the Apache projects are equally splendid (if you want me to say, cool, find yourself an American).
But, here’s the rub. I think Tomcat is excellent and very robust, however, many, many software projects do not need enterprise scalability. I’ve done projects that had global reach, so I’m not talking through my hat here.
I like JSP a great deal, and there are many excellent Java/Web apps in Open Source (I should know, I use many of them).
Another ‘but’, I recently had to put together a prototype of a complex application. I dipped into two or three PHP projects I’ve been monitoring in in literally hours had something better than the Java-based code I’d done earlier.
The long and the short of it is, in my opinion, if you need a decent and effective tool that does not need all the enterprise grade bells, use PHP for your web-apps. You can integrate to Java processes, like Web Services-based apps easily. Hence separation of concerns.
Don’t drink the Big IT Kool-aid: Much of that hokum about the need for scalability exists for Sun to sell you another server or Microsoft another license. Using Microsoft technology on one project, we ran to 21 mid-range servers. 21! What was this? a debutante party? Before you unload against Microsoft, another Java-based application running on Sun would have required at least 64GB of RAM (It ran in Windows 2000 in 1GB. Go figure).
I’m now ready to throw my hat in the ring for PHP for most web based projects, talking to a Web Services back-end. I’ve seen to many good quality PHP apps to get Java-religion.
After all, using PHP is not like using Visual Basic, so that’s OK, isn’t it?
Sorry for the lengthy post, but I just had to get this off my chest. In summary, don’t get religion, get pragmatic- use tools that fit the task.
May 28th, 2004 at 4:03 am
bugs
http://dotnetjunkies.com/WebLog/stefandemetz/archive/2004/03/31/10465.aspx
June 17th, 2004 at 8:04 am
looks like the PHP script driving this page has not been written correctly……… data is not being escaped properly especially with single and double quotes
June 19th, 2004 at 5:27 pm
you are correct, saurab. Older comments started showing extra slashes in an upgrade to WordPress 1.2. This should be fixed now.
September 4th, 2004 at 1:16 pm
It would be cool if Java could be distributed in the Apache or BSD license.
February 16th, 2006 at 11:54 pm
PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.)
PHP is free to download and use
PHP scripts are executed on the server
PHP files are returned to the browser as plain HTML.
PHP script can be embided with in HTML script.
March 4th, 2008 at 2:21 am
@Peter
“get pragmatic- use tools that fit the task.”
Too right mate
Anyway, there’s no point getting religious about it when you really understand the saying: “Programming Is Programming”.
A programming language is to programming as a calculator is to maths. Good programming skills are learnt separately from the language. If you know what you’re doing, sure, you can write excellent and resusable OOP code in PHP.
The 3 languages I use most are: Java, PHP and C++.
March 4th, 2008 at 2:26 am
P.S Just because it’s *easy* to create a quick and dirty procedural application in PHP does not mean you should do it! PHP has a pretty adequate OOP implementation and many frameworks (most of with are based on the MVC architecture), and the MVC architecture is based on OOP.
On of the frameworks available is CakePHP which seperates logic from the presentation. If you don’t have the discipline to implement good modular code without language restraints (for example myself), then use a framework or something. It can be a strict teacher. That’s good.
November 10th, 2008 at 2:22 am
????? “?????????” ???????????? ?? ?????????? ?????, ??????????? “??????? ????????? ?????????”. ?? ?????? ?????? ???????? ????????? ? ????????? ??????? ?????? ?????????, ??, ???? ?????????, ????? ???? ???? ????? ??????. ????????????? ?????? ???????????, ?? ?? ?????????? ????????? ???????? ????. ????????? ??? ??? ?????? ????????? ????????????? ??????, ???????????? ?????, ??????????????? ???????, ?????? ????????? ????????? ? ?????? ?????? ?? ??????? ??????? ??? ????.
???????????: ??????????? ? ?????????????
November 10th, 2008 at 2:33 am
??? ????, ????? ??????? ??????-???? ??? ???????? ???????????? ????? ????????? ??????, ????? ??????? ????? ?????? ?????? ???????, ??????? ????????? ?????????? ????????. ? ?????????? ????????? ??????????????? ????????? ???? ??????? ? ??????: ??????????? ?????? ? ?????, ?????? ? ????? ????????? ?????????? ????????? (????? - ???????????? ?????? ? ?????), ??????? ?????? ? ?????. ????????? ???????? ??? ???????? ? ??????? ??????? ?????????? ???????, ??????????????? ??????, ?????? ????????? ??????? ??, ??????? ???????? ?????? ? ?????? ?????? ?? ?????? ?? ????? ?????.
???????????? ??????
November 10th, 2008 at 9:57 am
????????? ???????? - ????? ?????? ? ???????? ????? ?????? ?????. ????? ?? ????? ????????????? ? ????????? ??????????: ?? ????? ??????????, ?? ??????????? ??????? ???????? ????????. ????? ???????? ??? ????? ??????? ????????? ??????????, ??? ??????? ????? ??? ?????????? ?????????, ??????? ?????? ?? ????????? ??????????, ???????????? ????????? ?????????? ? ?????? ?????? ?? ?????? ??????? ?? ????? ?????.
??????? ?????? ?? ????????? ??????????
November 12th, 2008 at 1:17 am
?????? ???????????? ??????? ????????? ????????? ?? ?????????? ? ??????????? ?????? ?????? ? ????. ???????? ? ????????????, ???????????? ? ???????????? - ?????? ???? ? ?????????? ????????. ????? ????????? ?????????? ? ???????????, ?? ?????????, ???????? ??????????, ?????????????? ??????, ????????????? ?????????? ????? ????? ?? ????? ?????.
?????? ??????????????? ???????
November 12th, 2008 at 9:46 am
?????? ??????????????????? ???????????? ? ?? ???????, ????????????? ?????????? ??????????? ?????, ????? ????????? ?? ??? ???????????. ?????? ??????????? - ??? ??? ?????, ??????? ??????? ???????????? ????? ????????????? ???????????? ???????????????; ?????? - ??? ???????? ?????, ??????? ??????? ??????? ????????????? ???????? ???????????? ??? ?????????????? ????????????. ?????? ????????? ?????????? ??? ?????? ???????????????????, ??????????? ???????????????????, ??????? ??????????, ??????? ???????? ??????????????????? ? ?????? ?????? ?? ?????? ?? ????? ?????.
??????????? ?????????
November 12th, 2008 at 5:40 pm
?????????????? ????????? - ?????????? ???????????? ???? ?????????? ???????? ?????????. ??? ?????????? ???????? ????????? ? ????????? ???????????? ?????????????????? ?????, ??????????????? ?????, ?????? ?????????, ????? ??? ??????? ? ??????? ?????????. ??????? ?????????? ???? ??????? ?? ???????????? ?????????? ?????, ??????? ? ???????? ??? ???????. ??? ??? ?? ?? ????????? ? ???????????? ?????? ??????????????? ???????? ?? ???? ? ?????? ?????? ?? ??????? ?? ????? ?????. ?????????? ??????? ???????
November 13th, 2008 at 10:24 am
? ???????? ???????????? ????? ??????? ????? ? ???????, ??????? ???? ??????? ?? ???: ?????? ? ??????????, ??????? ?????????????? ?????????????. ? ????? ?????? ????????? ?????????? ????????? ????? ????????????? ??? ???????????? ?????, ?????y????, ? ??????? ???????? ????? ???y???? ?????, ??? ?????? ??????????????. ??? ??? ? ?????? ?????? ????? ?????? ?? ????? ?????.
??????? ???????? ?????????????? ???????
November 13th, 2008 at 6:02 pm
“??????? ?????????? ??????, ? ???? - ???????? ??????? ????????”, ?????? ???? ??????????? ?????????????? ? ?????????? ?????? ????-???????????. ?? ?????? ?????? ?????? ????? ?????????? ???? ?????? ? ?????????, ?? ??? ?? ?????????? ? ???????? ?????????? ???????? ???????? - ????? ?????, ?????????? ???????? ?????????? ????? ????????. ?? ??????? ??????? ????? ?? ?????? ?????????? ????????? ??? pr ?????????. ??????? ?? ??? ???? ? ??????? ???, ??? ??? ?????.
??????? ??????????? ??????? ? ???????
November 13th, 2008 at 6:25 pm
? ???????????? ????? ??????? ????? ? ???????, ??????? ???? ????????? ?? ???: ??????, ????y?????, ??????? ?????????????? ?????????????. ?????????? ????????? ???????? ???????????????? ???????? ?????????????? ? ????????????: ???????????? ??????? ???????? ?????????? ??????????; ???????????? ????????? ???????? ??? ?????????; ???????????? ????????? ???????? ??? ???? ??????????? ?????????; ??????? ???? ?? ????????????. ??? ??? ? ?????? ?????? ????? ?????? ?? ????? ?????.
?????? ??????????
November 15th, 2008 at 5:15 am
? ????????? ?????, ????? ?? ???????? ??????????? ?????????? ????????? ??????, ?????????? ?????????? ?????????? ??????. ???? ?????? ????????? ???? ???????? ??????????? ????????? ???????????? ?????? ? ?????????? ?????????. ???? ??
????? ????????????? ??????????? ?????????? ?????? ?????? ?? ??????????? ????????, ?? ?????? ?????? ? ??????????????? ????????? ?? ?? ??????????????. ????????? ???????? ?? ????? ??????
November 15th, 2008 at 7:10 am
????? ?? ??????? ??????? ??????? ?? ????? ??????????? ????? ?????? ???, ??? ????? ??????????? ?????????? ????? ?????????? ? ??????. ????? ?? ???????? ?????????, ?????? ??? ??????? ????????? ?????? ?????? ? ????????. ?? ?????? ??????? ??? ?? ???? ????? ?? ??????? ??????????. ?????? ?? ????????, ?????????? ?????????????????? ?????????, ???????????? ??????????????? ??????? - ??? ??? ???????? ? ????? ????? - ???????? ????? ?? ?????. ?????? ????????? ???????? ? ?????????????? ??????? ?????? ? ??????? ?????, ????????? ??????, ???????????? ???????? ??????????? ??????, ???? ??????? ? ??????????? ?????? ????? ?? ????? ?????.
???????? ?????? ????????? ????????
November 22nd, 2008 at 9:45 pm
???????, ????? ?? ??????????? ??????? ??????????? ??? ?????? ? ????, ?????????? ????????? ???????????? ??????. ??????? ?????? ????????????? ????, ??? ?????????? ???????????? ?????? ?????????????? ??????????? ?????? ? ?????????? ?????????. ?????? ???? ?????? ??????????????? ?????????? ???????????? ????? ?????? ?? ??????????? ????????, ?? ?????? ?????? ? ??????????? ?????? ?? ?? ?????????????. ??? ??? ??????? ?? ??????? ??????
November 24th, 2008 at 9:23 pm
?? ??????????? ?????, ????? ?? ??????????? ?????????? ????????? ??????, ???????? ?????????? ???????????? ??????. ????? ???? ?????? ????????????? ??????? ?????? ????? ?? ????????? ??????????? ???? ?????? ? ?????????? ?????????. ?????? ???? ???????????? ?????????? ?????????? ?????? ?????? ?? ????????? ????????, ?? ?????? ?????? ? ??????????????? ????????? ?? ?? ?????????????. ??. ?????? ??????
November 26th, 2008 at 7:07 pm
??? ????? ??????? kychas.ru ???????????????? ? ????? ???????? ????????? ???????, ??????? ?????? ????????????????? ?? ?????????, ??? ???????? ???, ? ????? ???????? ???????? ? ?????? ???????? ??????????. ??????? ????????? ? ??????????? ????????????, ??? ????????? ????????? ??????? ??????? ??????????? ????????, ??????? ??????? ??? ?????????
????????? ???????????? ?????? ?????? ?
December 5th, 2008 at 9:46 pm
??? ????? ??????? sbpods.ru ??????? ??? ???????????????? ? ?????? ?????????, ??????? ?? ?????? ? ???????? ? ?????? ??????? ? ???????. ???? ????????, ?????????????????? ?????? ?? ?????????? ??????. ??????? ??????????? ????????????, ??? ????????? ????????? ??????? ??????? ??????????? ??????????, ??????? ????? ????????????? ??????? ? ????????? ??? ?????????.
??????? ??????
December 15th, 2008 at 7:15 pm
???????????? ?????? ???? ? ????, ???????? ?? ??, ??? ????? ??????????? ????????? - ???? ?? ????? ????????????? ???? ???????. ???????, ???????, ???????, ???????????, ?????????, ????????????? ???????????? - ?? ?????? ?????? ?? ???? ?? ????? ?????. ?? ??????????, ??? ???????? ????? ?????????? ???????? ? ???????????, ??? ????????? ??????? ????????? ? ??? ?????????????? ??????? ????????. ?? ?????? ??? ????? ?????????, ???????????? ??? ??? ????? ???????. ?? ????? ?????? ?? ??? ???? ???????.
????????? ???? ??????? ????????????
December 21st, 2008 at 1:20 am
?????c? ?p??c??????? c???? ?????????c??? ??????p??, c???c??????? ? ????????????? ????c??????-?????????c??? ??p??????. ??? ????? ?????? ??c?p?????? c????c?? ?? ?c?? ??p??????, ?? ?p??????????? ????? c???p????? ? ?????? ?? ???. C????c?? ?????c??, ?? p??? ? ????c??????? ??c?p??????c??? ??p???????c? ?????????c??? c?p??? ????c???, ?p?p???? ? ????????? ??c???pc???. ?????? ????? ? ??????? ???????? ???????????, ??????? ? ??????, ???????? ??????? ????? ?? ????? ?????. ??????? ???????????? ????????
December 25th, 2008 at 8:43 pm
???????? ?????? ????? ???????? ??? ????????????, ? ??????? ???????? ????????? ?????????????? ????????? ???????????? ?????? ??? ??????????? ?????. ?????? ???????? ??? ????? ?????? ?????, ??????? ?????????? ???????, ????????????? ?????? ????? ?? ??????? ?? ????? ?????.
?????????? ?????? ? ?????? ??????