3 ms·
...that's not really inherent in PHP. You can configure Python to be just as easy, and some webhosts do this... It's very rare to find webhosts that configure
by brendano 15y ago
...that's not really inherent in PHP. You can configure Python to be just as easy, and some webhosts do this...
It's very rare to find webhosts that configure Python, Ruby, Node or the rest to be as easy as "upload a file, click reload."
One reason is the wonderful statelessness of mod_php's execution model: it forks a new process for every request, and destroys it at the end. It's inherently a much more stable environment than the competitors -- you can't save anything inside the interpreter for future requests. This makes server administration easy, and probably shared hosting easier to manage.
- Lazare 15y agoThe original comment said "If you have a web server configured [for PHP] then it's ridiculously simple to get a page to execute." My point was that this is true for any language. You seem to be suggesting that the odds of picking a web server at random and having it be so configured for a given language is pretty low, which seems like quite a different issue, and (in my view) a pointless one. Nobody picks a webhost at random and just hopes that they have support, so the question is can you find support if you want it. :) In any case, it's also incorrect in the case of Python and arguably Ruby. The first three mass-market shared webhosts I can think of are Dreamhost, Webfaction, and Hostgator. Without any configuration at all, Dreamhost supports both Python and Ruby scripts as CGI programs, Hostgator supports Python scripts as CGI programs, and I believe Webfaction does as well. (Node is a lot newer and, admittedly, doesn't seem to have any support among mass-market shared webhosts.)
- brendano 15y agoPHP is much better than CGI, because it doesn't have to load an interpreter and all libraries per request -- they were loaded at server startup time. This is why all serious web frameworks don't use CGI. But PHP avoids the administrative/stability problems of persistent servers -- Python, Java, Ruby -- by disallowing state across requests. I think, because PHP servers are so stable, that's part of why they're so common on shared web hosts. For example, running a WSGI server is much more complicated. If a WSGI app goes bonkers you have to restart the relevant server. In mod_php, just kill the process. What would be interesting is a forking-style server for Python or another reasonable language.
- slurgfest 15y agoIt isn't true that "if a WSGI app goes bonkers you have to restart the relevant server." This is between you and your specific app server, it isn't a matter of WSGI.
- brendano 15y agoPHP has no app servers to go bonkers.
- Lazare 15y agoUm. We're getting a little bogged down here, but... 1) PHP is commonly implemented via CGI by many webhosts, even today. Not only is it generally considered more secure, but it lets you easily run multiple versions behind the same Apache instance. The performance hit isn't bad, either. So I'm not sure what "PHP is ... better than CGI" even means. 2) PHP is not particularly stable and it is not uncommon for a PHP process to hang until killed, often soaking up 100% CPU time. The stateless nature does make it easier to just kill it whenever it goes crazy, but it doesn't really have anything to do with how often it goes crazy. 3) You can configure servers in all sorts of ways, but there's nothing inherently harder about WSGI. You absolutely can just "kill the process". 4) I honestly have no idea what you mean by "a forking-style server for Python". Is there something you dislike about all the current ones? :)
- lmm 15y ago> 3) You can configure servers in all sorts of ways, but there's nothing inherently harder about WSGI. I'm willing to believe this - but if it's true, where are the cheap shared webhosts with WSGI enabled? Or do you think there's some other reason PHP is so much more widely available?
- Lazare 15y agoPeople seem really hung up on the idea that Python and WSGI are not supported by cheap shared webhosts. If you ever think "gee, I wish I had some decent shared WSGI hosting for less than $10/month" the answer is Webfaction. :) http://news.ycombinator.com/item?id=3826416 http://news.ycombinator.com/item?id=3826416 (@lmm: Sorry, I can't reply directly to your post.)
- sciurus 15y agoDreamhost supports ruby via phusion passenger now. http://wiki.dreamhost.com/Passenger http://wiki.dreamhost.com/Passenger