The case for switching from PHP to Python

I’ve been fooling around with Python for the last 24 hours and I am beginning to think that PHP users have good reason to consider a switch to Python. I don’t know much about Ruby on Rails but based on conversations with my Insider friend, Ishouvik, I’m pretty sure I could replace the word “Python” with “Ruby” here and what I’m saying would probably still apply.

Right now PHP is going through some pretty major changes. The community is becoming increasingly fragmented and more and more PHP developers are increasingly using the command prompt as their tool of choice for building sites. The days of Dreamweaver are long gone and everything seems to have became more technical.  From a technical viewpoint I think that the things which are happening with PHP are probably good, however, from a community perspective I think PHP is currently a disaster zone.  If PHP was a country then it would be in a state of civil war.  

I have good developer friends who are both excited and optimistic about the state of the PHP community.  Personally speaking, however, I’m a pessimist.  In spite of well intentioned efforts from the PHP-FIG group, I don’t see any prospect of the PHP community ever agreeing on how things should be done.  I also don’t see any prospect of the frameworks uniting nor do I see any prospect of one particular framework becoming the dominant PHP framework.  The PHP community is a shambles.

Whether or not you share my pessimism, I’m sure we could all agree that PHP appears to be becoming a more grown up language.  New features appear are being added constantly and we are (technically, at least) just about at a point where we can put PHP in the same playing field as more ‘proper’ programming languages like C++, Java and Python… kind of.

However, there’s a problem with PHP and I think it’s difficult to appreciate how huge this problem is unless you’ve ever had to hire developers to give you a helping hand.  PHP is a free for all.

That’s right.  It’s a free for all.  So, what I’m saying here is that you could get 100 PHP developers in a room and not find any two who do things the same way.  I have a friend called David who uses his own framework and another developer friend called Derek who uses ZF.  I have checked out their code and I can honestly say that they have virtually nothing in common.  When you compare what they’re doing it’s like looking at two different languages.

The English language will not allow me to express how much of a massive problem this is.  Last year I was ill for about six months and my income levels ground to a halt, completely.  I couldn’t outsource because it would mean training someone up.  All I could do was stay in bed watching my bank account dwindle lower and lower, month after month, until eventually I had no money at all and they shut my account down (thank you RBS).  As a matter of fact, my entire web development business – one of the first commercial web dev ventures in Europe – was wound up last year because of this.  It wasn’t lack of sales.  It wasn’t because I was doing a poor job.  It was because I was ill and I couldn’t outsource!  Why couldn’t I outsource?  Because I was using PHP!

As far as I can tell, there is a hope that Python doesn’t have this problem.

The entire Python community appears to be pushing in the same direction.  They’ve got an abundance of learning resources, they’re not all constantly at each other’s throats, they’re not suffering from an identity crisis and – unlike PHP – they’re not part of some insane rewrite culture.

Every time I see a new feature being announced for a PHP framework they seem to be becoming more and more like the big boys.  As a matter of fact, that seems to be the great selling point recently, doesn’t it?  So, here’s the question of all questions:

Why spend your time trying to do an impression of the big boys when you can actually be one of the big boys?

If you learn Python then you can be pretty sure that they’re not going to rewrite the whole thing in two weeks and render everything that you’ve built obsolete.  Then of course, there’s the features.  Python can be used to build mobile apps, games and desktop apps.  It’s a proper programming language.

Some PHP users will justify their allegiance to PHP by saying that there’s more of a demand for PHP developers since it’s an overall bigger community.  That’s just not true!  You see, employers aren’t actually hiring “php developers” these days.  They’re hiring WordPress developers, Zend developer, CodeIgniter developers… and fill in the blank with any other PHP faction that you care to think of.

Now if you investigate the amount of jobs searched for with any PHP faction then compare that to the amount of Python jobs then Python totally whoops PHP.  HERE IS YOUR PROOF.

So, since Python has better job opportunities, better features, more learning resources, a more harmonious community and a cooler name, then what reasons could there possibly be for sticking to PHP?

The only credible answer that I can think of is that PHP is easier to learn.

Well, perhaps that was the case a few years ago but try learning any of the next generation frameworks and see for yourself how difficult it is!  I have attempted to learn one of the new generation PHP frameworks (no name to protect those who aren’t here) and I have attempted to learn Python.  In my opinion Python looks easier to learn.  Even if I’m wrong about that then at least there’s tonnes of books about Python on Amazon.  I can’t say the same for the new PHP frameworks.

Ultimately, I think it all boils down to one this:

If Python is good enough for Google then it’s probably good enough for you. 


vintage furniture information


  1. “If Python is good enough for Google then it’s probably good enough for you.”
    You could also say:
    “If PHP is good enough for Facebook then it’s probably good enough for you.”
    So this statement doesn’t make much sense.
    Python is not only used for web, and so it makes sense that this language is much more used and asked for than any other web-centric language like php. Python is also very much used in the scientific area, so you will find tons of stuff on this part too.
    I think that, the choice of your language really depends on your style and culture. For example Python developper are knowed for having often one good and clean way of solving a problem and also, they are much more focused on code readability, documentation and testing. As PHP developpers, (no attack against anyone, just an observation) are so common, that finally, the internet ends up with a lot of code of very poor quality, even if frameworks like Zend or Symphony encourage you to make better design choices and unit test your code. But yeah, If i look at linkedin, everyone is an php expert somehow lol.

    1. parkerandhobbes · · Reply

      Thanks for a good comment, Ralph.

      The only thing I’d take issue with is your proposition that I make no sense (referencing Google using Python) since Facebook uses PHP.

      So, let’s talk about that.

      If any Python developer told a prospect that “Google uses Python” then I think that would be a reasonable thing to say. I can well imagine scenarios where Python developers might say that to help win clients and I can well imagine clients being impressed by that fact. Technically it might not be important at all but from a sort of crude bragging perspective, that fact does hold some weight.

      However, the proposition that “Facebook is built on PHP” is not entirely accurate. I’m not claiming to have inside knowledge about how Facebook works but I’m pretty sure they’re not using out of the box PHP or any of the frameworks that you or I might use. They have their own custom compiler (I think it’s called HipHop) getting used because normal PHP wouldn’t be up to the job for a site like Facebook.

      So, for any PHP developer to go around saying “Facebook uses PHP” is somewhat misleading. I don’t think it’s a reasonable thing to say and even though I’m sure there are big companies who do use PHP, from a traffic point of view or a financial point of view, I don’t think any of them are anywhere near as big as Google.

      Let us be clear. In spite of all the hype that you hear about Facebook, Google is the biggest tech stock on the planet. That’s why shares in Google cost well over $1,000 and shares in Facebook are about $65.

      Python being used by Google is something that is impressive and I insist that it makes perfect sense to consider that fact as being significant. Even if what I’m saying only makes sense from a crude marketing perspective then I can live with that.

      You comment was good. Talk soon,


      1. Thanks for the reply.

        I agree and yes Facebook’s use of PHP is quite special and we could even argue that it might have scaled out of control. I don’t argue about Python, because in my opinion it’s one the most amazing languages out there and the fact that Google uses it a lot is indeed amazing, and gives to us a certain validation on the technology.

        Anyway, the battle of choosing the “best” programming language is often without an end, even if personally, I started using Python a few weeks ago, and I love it.
        Code readability might be the strongest point. Combining it with a good IDE like PyCharm, which gives you a very nice auto-complete, perfect for going over the learning curve very fast.

        I can only end by saying, that I hope that your next article will be something like “Why I switched to Python”

        Keep it up

  2. On considering Python over PHP: (this is more than a passing comment David – be warned)

    Is it just me, or is installing, setting up and configuring frameworks ridiculously complicated?

    Ok, so I decided I want to learn to code. I did a little bit when I was younger – I’m now 34, with a full time job and a six month old daughter. I don’t have the time I’d like to devote to coding. But I enjoy it and who know’s where it could lead right? So I figured a nice, simple framework to ease me into the world of php might be in order. It could take care of all the difficult, repetitive tasks associated with server-side scripting, database connectivity etc. It did occur to me that I know next-to-nothing of what these purportedly tedious tasks entail, never having had to engage in them in any profound sort of way. But hey, if it’s going to save me time, who am I to argue? Even if I was oblivious to the intricacies of its’ benefits.

    So here I go:
    As you read this (if you read this) it’s worth bearing in mind that I’ve diagnosed myself as a type 2 developer. Now, I’d heard about CakePHP, and Zend, so I skipped right over them, as I’d been informed – rightly or wrongly – that they’d become bloated. I was after something ‘light’. You recall, I wasn’t too sure I wanted a framework at all – I have a couple of ideas for a few things and I need to get going as soon as possible. Also, I didn’t want to stray too far from pure PHP because I acknowledged that being language agnostic, let alone remaining framework agnostic has it’s benefits. Yes, I do listen to your podcasts, David.

    So, I moved on to CodeIgniter – and loved it. Few little issues with the documentation and the youtube tuts not including ‘CI’ in front of classes but, you know, it was pretty cool. UNTIL…

    Until I found out that the CodeIngniter community was emigrating in their droves to all manner of frameworks upon speculation that it was dead on account of it being put up for adoption. No potential foster parents in sight. Not a long-term prospect it would seem.

    Moving on – Yii. Yii was recommended to me by a colleague. He’s a frontend developer who loves Yii because it’s lightweight and it takes care of the MVC and CRUD stuff for him. I made a mental note for find out what MVC and CRUD was and decided to download Yii. It wasn’t too difficult, sure there was some pain when it came to getting it correctly installed – the memories of which, for the most part I’ve mentally blocked, but otherwise it was smooth. I do remember stalling however for quite some time because I hadn’t realised that I was one of the people who should be prefixing my commands with ‘php’ and adding .php to yiic…

    Anyway after configuring Yii, and Gii, I got my first app up and running in no time! I say that because you literally don’t type a single line of code. It’s already created! A little concerned that I’m STILL not actually writing code, but, ok I think this might be worth investing in. So I find the only decent book on Yii that I can find and buy it. Now I’m following the code in the book, not much actual coding yet, just explaining the structure of yii webapps etc, but everything is trundling along ok. UNTIL… I need to install phpUnit. But before that, I need to install Pear. To install Pear I can use a program call ‘wget’. But I don’t have ‘wget’. But it turns out that I can use curl instead as it ostensibly comes pre-installed with my OS. So I need to use Curl. So I bumble through and I somehow manage to install pear. Now I have Pear. I don’t know what pear actually is, or does, or if I’ve configured it properly. I probably don’t need to point out at this point that I have low competence using terminal, common symptom of type 2s? ALL of this was done muddling through in bash. Ok, so I’m at the point where I can install phpunit. So I go to and read through the site and get to where tells me how to install it using pear. I followed those instructions and it WORKED! Huzzah! Wait, did I have to be in a specific directory when I installed phpunit? Hope not. Anyway, let’s get back to the book.

    The book is telling me I need to write a bit of test code in the form of a class to verify that my database exists and I have a connection with it. Cool. I’m happy, I’m writing code, sure it’s only test code, but I’m actually writing some code for the first time in a couple of days! So I create the class, it’s very straight forward: just copy the code from the book and viola! UNTIL… I navigate to the correct directory – “webroot (aka htdocs) /[appName]/protected/tests” then I try to run ‘phpunit’ and get one warning and one fatal error. I go back one directory and try to run phpunit from there, and, well, at least the command is recognised – but as soon as I’m in the directory I want to be in, it dies. I frig around for a hour or so trying to get it working – to no avail.

    I have, at this point barely written a line of code. Now I’m thinking: “Screw you Yii – too complicated”. On the positive side, I found out CRUD stands for Create, Read, Update and Delete and MVC was an important and useful development ‘pattern’.

    So I look at Laravel – the up and coming. I have php 5.3.6 installed on my mac – I know it’s not the latest, but you know – it’s stable, relatively new and all that…

    Laravel’s requirements are “PHP 5.3.7 and Composer”. What’s Composer? Not sure. But I need it.
    Now I shall look at how to update PHP and hope that whatever irreparable damage I’ve done to my system configuration in the prior butchering doesn’t affect that.

    Mid-wrestle rant:

    Since taking the decision to learn PHP three days ago, I have been buried in config and command line hell and not written any meaningful amounts of code, barely a line. What little code I did write was test code anyway! It is absolutely ridiculous. This isn’t a framework. This is do-it-yourself scaffolding.
    Why isn’t there an easier way? What happened to the install button? It would be easy I suppose to dismiss me as a fool; bereft of the requisite intellect to code, evident in my repeated failure to pass the simple initiation: to configure the environment so as to begin writing code. I assure you, David, that despite appreciating that to state it bluntly would itself be discreditable, I possess a high IQ. I submit to you that the process of installing a PHP framework can be unnecessarily and prohibitively complex to a budding web developer with reasonable intelligence – the very same framework intended to make that same web developer’s life easier. I say this in frustration having taken the decision to begin coding some days ago and here I am no further down the track, and left with a bunch of frameworks, improperly configured and a couple of books I downloaded on kindle. I should also point out that I have had similarly depressing experiences with Ruby on Rails. This was the reason I ended up going back to tried and true PHP!

    Ok, rant over, now I have to look up how to upgrade php, so that I can install composer, so that I can then install Lavavel. After which I am sure that I will be told how to install other components I didn’t know I needed. Unless of course, what they say on their site is true and I quote: “Laravel needs almost no configuration out of the box.” – why not, I could use a good laugh.

    Wish me luck.


    Ok, so, the new php version wasn’t found, so I decided to download the latest version of MAMP, thinking, rather unscientifically that I could start afresh, and blow everything away with the latest and greatest version of everything. No such luck. Now my MySQL server refuses to start. Only a slight hiccup though, nothing a magical full system restart won’t fix…

    [several minutes later…]

    So, I’ve got PHP 5.5.10. Woohoo! MAMP 3.03. Woohoo! Now, onwards and upwards. I’m a little frayed around the edges, but making progress. Ok. Composer first it seems.

    To download Composer, I need to use my (not so) trusty terminal skills ( I refer you once again to my opening remarks regarding my type 2 personality disorder). So here we go, I type in the prescribed command:

    $ curl -sS | php

    Red AND yellow error messages – that’s new. It can’t find my fresh, mint condition, never-been-used, virgin php.ini file…

    After searching the web I found a site where a guy posted the solution to this puzzle: what a legend he is. Got past that hurdle with minimal knee-scraping. Ok, back to terminal, same command as before: things are happening, my terminal window is scrolling with reassuring lists of jibberish: “downloading this” ,”installing that”, “creating these”… then…


    “Mcrypt PHP extension required…”


    I’m defeated, David. Death by a thousand cuts. I am the Leonidas to the frameworks’ Xerxes in this Thermopylaen battle: brave, yet in the end only able to hold off a vastly superior force comprised of command line errors, package-installers and stackoverflow-false-messiahs for a couple of days before eventually succumbing.

    Suffice to say, not a single step in this disastrous process has transpired the way in which it was advertised to do so. Each, vertical inch I climbed revealed more of the mountain above me through the mist. Or rather, each time I thought I’d reached the summit, the fog clears a little and I realised that there was more to go. How much more? It’s not clear. My humour would almost certainly have been more rigorously tested had any of this been paid for in any currency other than my time. As it turns out, my humour is still intact, which is more than I can say for my ~/.bash_profile, $PATH, whatever that is… Perhaps one day I will do as Jimi did: standup next to the mountain, and chop it down with the edge of my hand. But not today. The weekend has come and gone, and I have to go back to my real job tomorrow.

    So I chuckle at my humble dreams of gaining access to the PHP web developers clubhouse: I wasn’t able to work the front doorknob, despite seemingly having the opposable thumb to do so.

    Next stop: Python and Django.


  3. Dravion · · Reply

    I feel your pain, brother. Iam a GErman dev and i was in every shithole you descibed in your post.I finally get it configured and working but it was a nightmare. PYthon looks promising, espacially as i saw pycharm. But there is a major drawback in Django, CG, laravel, symfony andveven phalcon and yii, mvc vor even zend or catalyst. there is no real focus in xss and crsf prevention.Any test in auto generated code wont pass an real world security scan.Its only a matter oft time and effort until a framework based site is highjacked and customers are exposed to criminal hackers. i think Python is a cool language and pycharm is hot but i will stick with my own code and try avoiding frameworks.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: