Ask HN: python vs. php for web projects

9 points by typicalday ↗ HN
Hi all,

My co-founder and I are working on several web projects, fishing for a new startup idea.

We've made our first prototype using django/python and we're working on our second using cake/php.

We'd like to stick to one language and/or framework. My co-founder and I are now disagreeing as to which language and which framework to move forward using.

We're pretty new to building production sites from scratch, so my question to the community is:

what are the advantages/disadvantages to using python vs. php vs. django vs. cake-php vs. other?

Thanks!

14 comments

[ 3.0 ms ] story [ 54.1 ms ] thread
I would use raw php, or codeigniter if a framework is needed. nod.js looks promising
Whatever language the person who's going to be doing the most coding is most comfortable with.

If there's no consensus there, then make a decision based on the strength of your framework's community, quality of your framework's documentation, and the availability of good libraries for what you anticipate doing.

I haven't used PHP much compared to Python but here are my 2 cents:

- PHP seems to have more security problems, so you should probably avoid it if security is important for your app.

- PHP is simpler to deploy, which might be important if you want to distribute your code for deployment by other people (eg. CMS, blog engine...)

Python is a better general-purpose language IMO -- you can do everything from smallish scripts, to web scrapers, to servers of varying complexity quite easily whereas I don't think PHP has this sort of breadth.

In terms of overall design, Python is mostly well thought-out -- PHP feels more like things were bolted on haphazardly. Also, some of the nuances about how types work in PHP just blows the mind...

Also, I'd ask around in the community a bit -- ask 10 startups that are on PHP vs 10 startups that are on Python if they'd stick with their language for a new startup or product. I'd bet hands down the Python guys outnumber the PHP guys.

Awesome thread!! I've been wanting to get feedback on this too, thx
Background: I did a 100k+ users web app using cakePHP and was very happy with it (2 years ago). Now a day, I use Django/Python as my main weapon of choice when I am thinking about complex web application. For simpler sites/CMS, I'm actually giving wordpress a try.

My thoughts on your question: I am a developer first, so I tend to forget the most important part of the business-have one! If your product isn't launched, you don't have a business just yet. Therefore, if using cakePHP can get your stuff out faster and with a simpler server setup, go for it. If you're comfortable with both (Django & CakePHP), then choose Python. It's easier to fix a painting when you make the first stroke. It's that blank canvas that scares us all. Go ahead, make the first stroke. Do the prototype in PHP if you can do it faster. Once the logic is written in one language, it doesn't take that long to redo it in another language. At least that's how my experience had been.

Good luck and hope you resolve your disagreement soon. There's no time to waste.

PHP's acceptance at the shared hosting level ended up being a curse of a sort IMO. While it was easy to install applications, it was nearly impossible to know what libaries were installed. You could never rely on PEAR or anything else.

You can imagine what kind of solutions people will come up with when the standard library is anemic (compared to python) and it was difficult rely on certain "standard" 3rd party libraries.

Python folks rarely had to deal with the shared hosting issues (until very recently) and by virtue were freer in what they could install and how they could secure the system.

As far as actually choosing one or the other. You really can't go wrong with either. Modern PHP frameworks have done a great job in making it easy to write secure, flexible, and speedy applications.

As a long time PHP developer (but dabbler in many others) I really can't thank Rails enough for forcing the PHP community to really push PHP libraries/applications forward.

Cross pollination FTW

There's a lot more people using PHP compared to Python, naturally there's more support of PHP in terms of libraries, support, etc.

But for a startup? Means nothing pretty much. Whichever helps you execute best. If it takes 10x longer to learn Python compared to PHP, do you really want to switch to Python? Or vice versa due if your founder has to learn PHP?

> naturally there's more support of PHP in terms of libraries, support, etc.

I don't think that's true. I have been part of both the ecosystems, and Python has equal (if not better) support in terms of libraries.

Agreed, Python has ample libraries. Can't say whether its more or less than PHP, but once you reach a certain threshold (theres a library for almost everything) it doesn't really matter. They are both very active communities with lots of contributors. I learned in PHP and switched to Python. I have never looked back. In fact I now refuse to take jobs that involve PHP. Its just too screwy and the chances that you will be dumped into a sea of terrible code are much greater.
You say you and your co-founder disagree on this, who does the most coding?

You should go with what ever the one of you does the most coding prefers.

There are new languages popping up every day, each with legions of fans telling you why the new language is better than everything else.

In the end you can either spend your life being mediocre at every new fad language that comes out, or you can learn one language, and learn it well.

As for me, I'm primarily a PHP man, but I do like Ruby as well. Of course my opinion doesn't matter, it's about what works best for you as a team :)

I went through the same thing last year.My startup went with python/django over php/codeIgniter. I think the top two selling points of the python/django solution were the quick-to-prototype (tones of apps) and the cool factor. My boss was worried about attracting hackers, so the cool factor was important to him. The development benefits of django apps were nice, features were implemented faster, but at times it was frustrating to customize. The other big benefit was south - a django app for managing data and schema migrations. In our php solution we had to manually write sql scripts.

All that being said, I agree with everyone else, the most important thing is to make the developer comfortable.