Received this yesterday:
So I’m thinking of starting a new web project and was wondering if I could seek your advice. My tendency is to use PHP since that’s what I know and have used most in the past. Though, after talking to a lot of folks (namely Googlers…go figure), I’ve been encouraged to instead choose Python.
Seeing as you’re my favorite PHP Terrorist I was wondering if you have any specific thoughts on the subject.
I still need to write another article on Python, but the short answer is I think if it’s web, PHP is probably the better choice.
“PHP is the shortest point between two distances on the web.”
—Me, tongue-tied at a talk
However there are some mitigating factors to consider:
- If your budget is very tight, then you can use Python and host it on Google App Engine. Yes, there are other solutions like Windows Azure and Ning, but I think that above shared hosting and short of slicehost, Google is the best option.
- If you only want to use/learn/maintain one language throughout the entire setup, then Python is a better choice. PHP can’t do high concurrency and it’s not very versatile by itself.
PHP’s advantages are its ubiquity (host anywhere), relatively low skill requirements (easy to pick up), and it’s ability to work with other software packages and languages with ease (simple and sucky). PHP is an easy second language to pick up because its similarity to scripting, C, Perl, etc., great documentation, and high availability. On the other hand, hiring good PHP developers who can design a clean architecture that isn’t overbuilt or spaghetti is hard.
Python’s advantages are its collaboration for larger projects (clean design and readability), and being probably the best general scripting language on the market (versatility). Python is also a much easier language to learn to program for the first time. Learning Python for the web, pretty much means learning two things though: Python and a framework like Django.
As for Google, I’m not surprised. Google is very pro-python when choosing a scripting language, sometimes to the point of irrationality—YouTube for instance. In fact, the knee jerk reaction of almost any Googler is “use Python” in response to any programming question where a scripting language is involved. The reality is there is no best—just a series of “good enough” choices.
Look at the top 100 websites on the internet: about 40% of them are written in PHP and 0% of them are written in Rails…But to me, there is an alternate conclusion, since 60% of sites out there don’t use PHP: “The web problem ain’t that hard.”
PHP may be the best web language out there. But it certainly isn’t the only one. It’s one approach, one that stresses configuration over convention, stupidity over smarts, practicality over elegance.
8 thoughts on “Who puts the P in LAMP?”
I have heard that Google is phasing out their internal use of Python as well, though it will continue to be an option for App Engine.
My recent post Music of the Decade
PHP Developer links this
I believe the greatest problem of PHP is the lack of native Unicode support, which in Python is not a problem, but it is very important for companies with sites that show text using multiple character sets, like Google.
Other than that, I think in practice Google just uses Python as compiled Java bytecodes because it is a better fit with the use of Java application servers that they use.
PHP is supposed to have native Unicode support in PHP 6, but I have not seen a realistic estimate of when PHP 6 will be stable for release. I hope it does not get the same fate as Perl 6.
Have a look: http://www.steike.com/code/php-must-die/
I like Python a lot, but compared to PHP it is downright painful to develop web apps with. For example: when using webpy, you have to restart fcgi everytime you make a code change. I have come to really respect the two phase setup/teardown system that PHP uses.
My recent post Unit Testing and the Law of Demeter