4 ms·
If you ask me why Python -- and Rails, for that matter -- aren't trouncing PHP, it's because Python ignores Windows, and doesn't focus on the web. Hold the fla
by seldo 17y ago
If you ask me why Python -- and Rails, for that matter -- aren't trouncing PHP, it's because Python ignores Windows, and doesn't focus on the web.
Hold the flame throwers for a second.
Everyone on this site knows you shouldn't be deploying websites on Windows. And I agree. WAMP is not a sensible production environment. But it's a great learning environment.
Because what the Python hackers of the world seem to forget is that 95% of all the computers in the world are running Windows. And for very large numbers of the owners of those computers "buy a second box and put Linux on it" is not an available option, and "run a virtual machine with Linux on it" is really complicated. They don't want to learn a new operating system, they want to learn a language to build websites in. In fact, all they want to do is _build websites_, and the language is the means to an end. They will take the path of least resistance, not the path that is most elegant.
You want to build a website in Python on Windows? Good luck. Sure, Python has a great Windows installer -- but then what? Django? Some other web framework? Have you tried installing Django on Windows? It is a gigantic pain in the ass. Oh, and the MySQL libraries aren't included. Oh, and they don't work with Python 2.6 unless you find a super-secret download mentioned only on a mailing list. And then you have to learn Python, and then Django, and then you have to work out how to deploy it to your host's web server.
Here's how you do the same thing in PHP. You go somewhere like here:
http://www.wampserver.com/ http://www.wampserver.com/
You download one file, run one installer, and it gives you Apache, PHP, and a MySQL server, all at the same time. You put some .php files in there and web pages start turning up in your browser. It's not pretty, it's not elegant, it doesn't scale, but it's your first web page ever and it's ready in 10 minutes. Ready to deploy? Copy your three PHP files to your web host via FTP, and presto, they work just like they did on your home machine.
Later, you discover frameworks. You learn about encapsulation, and MVC, and loose coupling and scalability. You work out that Windows is not exactly like your web host, which is running Linux. You might get around to installing Linux at that point, but you don't really have to because the differences are pretty minor. But whatever happens, at that point, you already know PHP. You're not going to switch languages.
Until Ruby and Python hackers swallow their pride and accept that welcoming newbies to the language means not forcing them to switch operating systems, PHP will continue to monopolize the market for beginner web developers, and hence the market for the professional developers that they turn into.
- GeneralMaximus 17y agoCan't upvote you enough. I mostly write desktop apps. I really want to write my own web apps, just as a fun exercise. So far, PHP looks like the only programming language that will let me write web apps without spending eight hours trying to set up a friggin' web server. I compile an entire OS from source every week (the Haiku trunk), but getting Python with Apache set up on OSX Leopard is something I always shy away from. (Also, why is it so hard to not have to use a framework to write your webapp in the Python world? All I want is a 'Hello World', not friggin' Facebook.)
- nostrademons 17y agoIIRC (untested), a "Hello world" webapp in the Python world is as simple as dropping this into your cgi-bin: #!/usr/bin/env python print 'Hello world' You can do CGI apps just as easily in Python as you can in other languages. It's just that CGI doesn't scale, and so you'll want a framework for anything more complicated than that. Incidentally, have you tried to setup PHP on a machine that doesn't already have it installed? (Particularly without using a package manager - with port or apt-get, Python isn't all that difficult to install either.) It's a frigging nightmare of building shared libraries, making sure they're in the right place, finding the right Apache config files to edit, and adding the appropriate LoadModule/AddType/AddExtension/whatevers. The reason PHP's easy to deploy is because most webhosts already have it preinstalled - they've done the work for you. If you use a Django-aware webhost like Webfaction, the process of creating a new Django app is reduced to clicking a button on your web-based control panel.
- garnet7 17y ago> It's just that CGI doesn't scale, and so you'll want a framework for anything more complicated than that. No, that's not the issue. The issue is, when you have a relatively small webapp that you want to be fast. It's large and fancy enough -- you just want it to be fast. So, for that you want a persistent language runtime, such that when your page gets accessed the already running Python interpreter just grabs your .pyc file and runs it immediatly. The final ingredient is that with php you can put your php files into your docroot so that you don't even have to mess with apache rewrite. If Python had those things, there wouldn't be any reason for a new user to choose php over python.