News for hackers. Stuff that matters.
Re:Taking PHP Seriously by tyingq on Thursday October 13, 2016 @05:17PM (#12704108)
>>Why are there no other "competitors" in this space?

There are. Any language that supports either fastcgi, or runs as an apache plugin (or similar) functions in the "each request starts new" space. There's certainly others, but Python and Perl are both good examples.

Starting new with each request does, of course, mean lots of re-work that shouldn't have to be done with each request. It does initially keep complexity down, but at scale, the applications I've worked with have to use a shared cache (like acpu) to avoid that rework and meet performance goals.

Re:Taking PHP Seriously by Klathmon on Thursday October 13, 2016 @05:21PM (#12704143)
I mean more of languages that actually "target" this kind of setup.

I know it can result in a lot of "extra work", but I really feel like most of the pain of that could be abstracted away by the runtime.

Nginx/apache setup a PHP process before the request comes in, so why couldn't you expose that point to your language and let the programming language do work before that point, even "snapshot"ing it to avoid re-doing that work for each request?

It just seems like there are better ways of solving this problem, because an event loop is such a "hammer" solution to the problem.

Re:Taking PHP Seriously by jstimpfle on Thursday October 13, 2016 @05:54PM (#12704374)
I think python has exactly that with WSGI. With this protocol you make a module containg an "application" function object which is called by the server when a request arrives. On module load time you can do any required setup work.

(On my systems, by default there is some reuse of the loaded module, so you can leak state between requests. However it should be possible to avoid reused processes).

Re:Taking PHP Seriously by ryanlm on Thursday October 13, 2016 @11:11PM (#12705921)
Can you set up Python to have the same pattern as PHP? I've always had to proxy the web server to the Python process running HTTP.
Re:Taking PHP Seriously by tyingq on Friday October 14, 2016 @07:25AM (#12707373)
Python via fastcgi, wscgi, etc, is the same pattern. Or mod_python inside Apache.
Re:Taking PHP Seriously by gkya on Saturday October 15, 2016 @06:27AM (#12713479)

  import cgi
Also, the httpd communicates to the CGI program via environment variables so one can also write their program in assembly.
Re:Taking PHP Seriously by dfsegoat on Friday October 14, 2016 @10:05AM (#12708112)
Yeah, I run new django apps right alongside my php5 code. It does definitely take a bit more "muss and fuss" than php5 to configure (mod_wsgi, etc) but is just as easy.

You also need to restart apache or change the wsgi loader file, (or set up explicit hoooks to do so) to get your new code to appear when debugging / after uploading changes. This is where I'd say php is superior (upload file, refresh browser).

Re:Taking PHP Seriously by ubernostrum on Saturday October 15, 2016 @05:45PM (#12715789)
Back in the day, mod_python also supported PSP (Python Server Pages), which was similar to PHP/ASP in that it allowed you to write a file as a mix of HTML and Python code inside delimiting tags.