Why is PHP so popular?

I notice that most questions on this forum seem to be about PHP. I just wonder what is behind that. It is because the perception that this is the language to impress future employers? Or is it perceived to be technologically superior to everything else on Sitepoint forum community? Or some other reason?

Your thoughts?

I suppose I should add that I am primarily a python web developer and I am happy with that choice but I feel like I’m in the minority here.

Just my uneducated opinion, but the big advantage I see in PHP is that most web hosts are set up for it out of the box, while they tend not to be for anything else (although I have no idea about Python etc. What do you do about hosting Python?)

The main thing python needs is python installed on the web host and WSGI support in the web server. (Web Server Gateway Interface). Although I am told it will work with CGI and FCGI mode also I haven’t personally tried it that way. Whichever choice is usually loaded as a web server module. Pretty straightforward really.

PHP is easiest to install with all defaults (which seems to be the norm) but in that mode PHP can be run under document root which is a little scary as arbitrary PHP files can be executed. Granted that PHP can be installed in a much more secure way but this is generally not how it is set up on a lot of shared hosts and it also takes more work.

Python, in default setup, is slightly more complex, but not by much and is also much more secure.

However I notice that a lot of even free hosts offer python support these days which is different to how it used to be 5 years ago.

I think that the reason why PHP is so popular is because it is not extremely hard to learn, it is widely supported and there’s a huge community and lots of documentation. Also you may find answers almost to any question that you can think of because it is so well known.
In addition to that, it works fine in Linux and Windows which means a lot when your moving from one host to another and you’re chaning OS for whatever reason.

Since PHP is widely used and important nowadays, especially with everyone using the internet. I think PHP would really be popular and almost everyone would love to learn it.

Hi,

PHP is very easy to use and there are lots of in build tools that helps the user to easily perform the task. You can easily get the solutions for any kinds of programming problems through net and only service help portals. That’s why the PHP demands increase day by day.

Thanks,

Yes, I think you are quite close to the truth there. They use it for the same reason most people use facebook. Not because its so wonderful and makes all their dreams come true but because most other people are already using it. They go for it because nearly everyone else is. However isn’t that the same reason that lemmings jump over a cliff? :wink:

One of the problems I foree with this approach is that people may be using PHP because its popular and not neccessarily because its the best tool for the job.

I suspect that PHP is popular because there are so many projects already written in it. For instance : Wordpress, PHPbb, Magento, EpesiCRM, and many others.

However popularity comes with its own problems. For instance Zend Corporation, who seem to be the ones in charge of the PHP language itself, cannot make radical improvements to the language without breaking legacy software. For instance I see that there are posts that explain why good threading support has been denied because it is now too hard to change the language itself without breaking stuff. Therefore I really question whether current popularity alone is enough to secure it in the halls of fame for future years to come.

Your thoughts?

PHP grew and became popular at the right time, with the network externality in the market(you know what I mean if you know what is LAMP servers and WordPress) it has benefited from the early advantages it gained in early 2000s. Still, PHP is very easy to use and learn, its also open source so easily accessible.

Interesting statement. However, PHP is easy to learn compared to what? I don’t think PHP is the easiest language to learn in the whole world. In fact I don’t think I would recommend it as a first language. The reason I feel that way is that PHP has too many “gotchas”. Its too easy to miss best practices in relation to PHP. To add substance to that last statement I add the following web link:

However, if you mean easy to install on a web server that I would understand. I think PHP made it easier to deploy web applications for sure and may well have been the first web language to add relatively straightforward database access at a time when no other good alternative was available. However I don’t think it holds that exclusive advantage today.

You are right, PHP is indeed designed poorly and there are so many things I wish it to change to become more object oriented nowadays. Still, you pretty much spoke it yourself why PHP is so popular. It was the first web language to add relatively straightforward database access, and it did this at the rightest time. Sure now there are much more alternatives, PHP already benefited from the Network externality effect of this market with LAMP servers and Wordpress, its in a ‘too big to fail’ mode.

True – I challenge you to name a rival system for each of those written with python. If you are able to I doubt they are as powerful and have nearly the amount of community/contributors behind them.

I think for 99% of the websites out there running on PHP thread safety is a total none issue. For that 1% of sites and/or middleware PHP probably isn’t the best option.I’ve worked with PHP now for 7 years and in that seven years I haven’t come across a problem that can’t be solved with PHP in one form or another. Do I know other languages yes but none as well as PHP and most software I work on these days is PHP related. Specifically I seem to have fallen pray to becoming a “Drupal Expert” though I’m not so sure that is a good or bad thing. I guess time will tell.

When it comes down to it though PHP is a powerful language with HUGE open source community and professional skill pool. Not to mention PHP has been around so long that many legacy systems exist that need to be supported until time/money allows them to be rebuilt if rebuilt at all. All these open source PHP projects have spawned sub professions where it isn’t enough to know just PHP but be an expert with the given open source tools being used.

I think the vast majority of professional, experienced engineers out there who work on PHP projects could likely work in just about any language. Though there is such a demand for PHP that it just isn’t practical to go that route unless you work for a company that will allow you to perhaps use a different technology stack. I mean many of the ruby, python and node listings require engineers with professional experience in those areas. An applicant could have ten years engineering experience but without professional projects in those technologies won’t be considered. So unless in they just so happen to be fortunate enough to work on a different stack their place of employment it is unlikely they would ever be accepted as an applicant for jobs using newer technology stacks.

I mean I’m not naive and think PHP is the greatest language on the face of this planet. It isn’t but it is more than capable in meeting *most client expectations when it comes to web development and even some middleware with the right configuration/environment set-up.

Even though I’m relatively young (27) I’m old school when it comes to this topic. I believe programming fundamentals should be learned through Java and/or c/c++. There are far better texts out there dealing with basic programming when comes to c and java. Not to mention if you have to write something in c/c++ you can latter start to appreciate how powerful PHP is when you don’t have to mess around with make files (building software), allocating memory, pointers, etc. Only when you have experience dealing with those problems can you truly appreciate the power of PHP and use it to it’s full potential.

I think PHP popularity will decline because even though it is free it will follow the same path as Basic and Internet Explorer. Need I elaborate?

OK, in PHP’s favour it does make web programming and especially database handling very easy.

@Kiwiheretic, your link, very interesting read and even far worse than what I imagined.
http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/

@oddz
[comment]
Not to mention if you have to write something in c/c++ you can latter start to appreciate how powerful PHP is when you don’t have to mess around with make files (building software), allocating memory, pointers, etc. Only when you have experience dealing with those problems can you truly appreciate the power of PHP and use it to it’s full potential.
[/comment]

I disagree and believe it far better to eliminate problems at source rather than discover undocumented features at a later date :slight_smile:

Before I ventured into PHP, I was familiar with C++ and Delphi (Pascal). Both languages bluntly refused to compile with errors. When I first started with PHP I found it unnerving to be able program and not declare variables types.

2-cents