That would be "from each according to his ability, to each according to his contribution," which is more or less the philosophy at work in socialism, at least at the outset.
"From each according to his ability, to each according to his need" means something rather different. It means that you contribute what you can, and you also get what you require, but the reception is not necessarily dependent on the contribution. I mean, local communities could decide if that were necessary or not, based upon local circumstances (perhaps there are shortages, droughts, whatever), but communism is supposed to be a post-demand society, meaning there's more than enough for everyone, so there's neither need nor justification for restricting peoples' access to it through silly things like prices or rations (and also of the requirement that everyone have a job and labour). As a human being, you are entitled to the necessities of life.
But getting there is hard, and we require an intermediate step between a money-based system of distribution and a needs-based one. That's an enormous mental gap that will probably take a long time to implement, over the course of generations.