News for hackers. Stuff that matters.
Re:The Slash Programming Language by kayoone on Saturday October 26, 2013 @07:25AM (#6617042)
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.

Re:The Slash Programming Language by Spidler on Saturday October 26, 2013 @08:16AM (#6617141)
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?

Re:The Slash Programming Language by nkuttler on Saturday October 26, 2013 @08:34AM (#6617185)
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.

Re:The Slash Programming Language by simpleigh on Saturday October 26, 2013 @09:01AM (#6617248)
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.

Re:The Slash Programming Language by nkuttler on Saturday October 26, 2013 @09:32AM (#6617329)
My bad, you're absolutely right. I meant mod_wsgi.

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

Re:The Slash Programming Language by borplk on Saturday October 26, 2013 @12:05PM (#6617839)
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

Re:The Slash Programming Language by nkuttler on Saturday October 26, 2013 @06:48PM (#6619773)
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.

Re:The Slash Programming Language by kayoone on Saturday October 26, 2013 @08:46AM (#6617219)
i was actually trying to make a PRO php argument ;)
Re:The Slash Programming Language by nilliams on Saturday October 26, 2013 @11:00AM (#6617587)
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.