Hacker News new | ask | show | jobs
by kayoone 4619 days ago
In todays development world i dont see any reason why to use python/ruby instead of php (which was different when Rails came out), even for large projects. The frameworks are very mature and the community is huge.

I see a point in using JS on the server instead of PHP though, still the frameworks have some catching up todo.

1 comments

Okay, I'll bite. I'm a nice guy.

Please tell me the deployment steps for a single-file python script.

With PHP, it's "install php mod_php, place files in directory" .

With Python it is... what?

Install python, mod_wsgi, and add two lines in the apache config.

The last step is just removed in PHP because of the "place files in directory" model, which is fundamentally broken and used by default. Application code shouldn't be in a place where the entire world can read it if for some reason your httpd doesn't parse it.

I'm not a pythonista but would question your recommendation of mod_python - the (current) top post at https://news.ycombinator.com/item?id=6616550 (also on the front page right now) states that "mod_python has been dead for so long now that its death has gone from a liability to a potential asset".

I totally agree that application code shouldn't be in a web-accessible directory - but that's a hosting/configuration problem, not a PHP (or even mod_php) problem. It's trivial to set up an index.php which bootstraps an application stored elsewhere on the server.

My bad, you're absolutely right. I meant mod_wsgi.

With regard to code location, I mentioned that because of Spidler's question.

Except:

1. WSGI configuration is more complicated than you make it sound

2. In your script you have to create a WSGI compliant app. Unlike PHP's quick and dirty method of spitting stdout on the webpage which is useful in making quick and dirty single file scripts

1. PHP's configuration isn't simpler in any way, it's just that the insecure method is already configured by default, so you don't have to set it up. Python doesn't have such an insecure method, so the (trivially easy) configuration is app-specific. And that's a good thing.

2. Yes, if quick and dirty is all you want, just use PHP, there's nothing wrong with using the right tool for the job. Personally I prefer quick and clean though, that's why I try to avoid PHP.

i was actually trying to make a PRO php argument ;)
in which case the answer to your:

> In todays development world i dont see any reason why to use python/ruby instead of php

... would probably just be that for anyone with a taste of Python and Ruby, PHP the language and dev-environment is a bitter pill to swallow, no matter how good the frameworks are now. Laravel looks pretty ace to me if I must do PHP, but I'd much rather use Python or Ruby.