Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

My web server uses PHP as do 76.9% of web servers according to W3Techs:

The reason I use PHP is an inertia born out of seeing everyone else using it on web servers. What is it about PHP that would make it so ubiquitous on web servers?

(Note that this question is similar to the following question but takes it in a different direction: Why isn't Java used for modern web application development?)

share|improve this question
I always assumed because it is easy to install on Apache and nearly all web servers are Apache. – maple_shaft Sep 26 '11 at 18:03
PHP is the language that proves that while nearly everybody can program, nearly all of them shouldn't. It's the Visual Basic of the web generation. – Paul Tomblin Sep 27 '11 at 13:56

5 Answers 5

up vote 40 down vote accepted

PHP is a language that is specifically designed for web programming with built-in integration with the most popular open source database MySQL.

  • Easy to start with: As a beginner it is easy to start with PHP. The user just have to add a few PHP-tags with e.g. a for-loop in it's existing HTML-files and then upload it to the server and see the result or an error message. Dynamic typing and associative arrays makes it also easier to start using PHP.

  • Easy to use: Compared to most solutions like e.g. Java, PHP doesn't need to be compiled, so it's just to write the script and then upload it to the server and then update the browser.

  • Integrated database support: PHP has (mostly) built-in support for the most popular databases like e.g. MySQL, that means it is easy to start using databases, no additional drivers needs to be installed, just to use the mysql-functions. The easy to use web based admin tool PHPMyAdmin (released 1998) is also important to the PHP's success in combination with MySQL.

  • Old language (since 1995) with a big user base: PHP became popular early (1995) since it was designed for web programming. Since then the user base has grown and now there is many web-oriented frameworks and libraries available. Some examples are blogg-systems and e-shopping-platforms.

  • Cheap hosting: Since PHP has existed for long time and works good on both Linux and Windows, and many webservers have support for it. There is no problem to find hosting with PHP pre-installed.

share|improve this answer
mark this as answer, you don't need to go further :P . Nice answer @Jonas – Pankaj Upadhyay Sep 26 '11 at 18:34
Most points here are also true for classic ASP. Oh, and also plain JSP. – Adrian Sep 26 '11 at 20:00
@Adrian: 1) PHP was released before both JSP and ASP. 2) It's easier to use MySQL with PHP since you don't have to handle ODBC or JDBC and drivers 3) ASP wasn't easy and widespread on Linux (cheap hosting) at the time. 4) Java with it's static typing is a bit harder to start with for a beginner. – Jonas Sep 26 '11 at 20:15
@Jonas, you are mostly reinforcing my point: 1) it was the only decent web language, so right place, right time. 3) LAMP, that's what my post is about. Also, take it easy, I'm not saying PHP is bad I'm just saying why it got popular: it filled a void, that's it. – Adrian Sep 26 '11 at 20:20
"Easy to start with" is, I think, what launched it. Perl existed, and could do everything PHP could do. But PHP was just that much easier for a complete novice to get started with. And I suspect the community was friendlier to novices as well. PHP filled the void that VB did for Windows programming - easy enough that people could get started on their own and actually create something. – GrandmasterB Sep 26 '11 at 20:48

I'm teaching myself PHP right now, so maybe I can answer.

A PHP source code file can contain a mix of HTML, JavaScript and PHP, so it seems really easy to get simple web applications up and running. More complex interactions, that would require lots of Java in a JSP situation, or some weird contortions in a CGI-BIN situation, get catered to by the PHP builtins: you don't even have to know if an HTTP GET or POST called your code, everything your code wants to know lives in _REQUEST or _SERVER or _COOKIE global variables.

PHP-the-langauage gets parsed and executed pretty rapidly so you won't notice a huge performance drop when generating HTML, rather than just having a bunch of static HTML files.

PHP-the-interpreter has library calls for just about every open source DBMS, and a lot of the proprietary ones, too, so making a 3-tier-style web app looks easy. PHP-the-interpreter includes library calls for a lot of other commons situations (a.k.a. "use cases"), so you don't have to write a lot of code yourself, just call the library. So, just like J2EE "enterprise apps", the problem moves from knowing how to code to knowing how to look library stuff up. This is aided by the very decent PHP manual.

As a programming language, PHP doesn't have a lot of exotic constructs, or differ too much from, say C, FORTRAN 4 or Pascal, so programmers that already know one language can easily pick up PHP-the-programming language.

share|improve this answer

For the same reason MySQL is so popular: it was at the right place in the right time.

With the Linux server boom in the 90's, the LAMP platform (Linux-Apache-MySQL-PHP) came to scene as a reliable and, most importantly, free option.

As a side note, take MySQL at the time. These were two missing features from MySQL (from the top of my mind, there might be more) not so long ago:

  • No triggers
  • Not fully ACID compliant

How did a DB that wasn't even ACID (atomicity-consistency-isolation-durability) compliant get to be so popular? Same answer as PHP: it was at the right place in the right time.

Further reading about the "right place right time" on LAMP components:

share|improve this answer
If "it was at the right place in the right time" is the answer, then Perl and CGI with C should have seen the same popularity. – Jonas Sep 26 '11 at 20:12
"How did a DB that wasn't even ACID compliant get to be so popular?" - thats easy... its just wasnt that important to most people. MySQL was reliable enough for most web uses. Reliable enough early on for a bank? Probably not. For a web forum? Yes. – GrandmasterB Sep 26 '11 at 20:45
I had a colleague the would scream "but MySQL is hardly a RDBMS!". I find that amusing. Popularity is a funny thing. We - software developers - must not be slaves of trend, we have to keep on learning to keep on working. Anyone who defends a tech too much is less likely to let go. And that's always professionally dangerous. This topic is over for me. :) – Adrian Sep 26 '11 at 20:48

If you look around, most folks running PHP these days are running Wordpress, Drupal, Joomla and the like. Or one of 10,000 free, popular apps that pretty much work out of the box with a cheap PHP host and a little configuration. Many times it gets installed not because anyone is making something that runs on PHP so much as the easiest option is to use something built on PHP.

share|improve this answer

Lets face it, PHP is cheap, easy to learn, has a larg community, you can host it anywhere and its been around a lot. So, if you think as someone using the internet as a way to make money fast in a small/medium industrie and having to create a development area to do so with a practically unexisting infraestructure, PHP sound pretty great (to start with).

So, i think PHP is a great way to make some money fast with a bunch of programmers and a small computer as a server.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.