8 ms·
True. A lot of webhosts are configured such that you can drop some PHP files into a directory via ftp, and it'll "just work". Which is nice. But... ...that'
by Lazare 15y ago
True. A lot of webhosts are configured such that you can drop some PHP files into a directory via ftp, and it'll "just work". Which is nice. But...
...that's not really inherent in PHP. You can configure Python to be just as easy, and some webhosts do this. Node is pretty much always this easy. Django and Rails can also be this easy (if you've ever used Webfaction, you'll know what I'm talking about).
And, on the flip side, if you want to install configure PHP yourself, it's actually not that easy. It's trivial to get a PHP page to execute given a web server configured to make it trivial (but, again, that's true for almost any language), but configuring the web server isn't trivial.
- maratd 15y ago> And, on the flip side, if you want to install configure PHP yourself, it's actually not that easy. http://www.lifelinux.com/how-to-install-nginx-and-php-fpm-on-centos-6-via-yum/ http://www.lifelinux.com/how-to-install-nginx-and-php-fpm-on... Looks pretty easy to me. Then again, I compile my own version of Apache with FastCGI and PHP-FPM all the time.
- tambourine_man 15y agoWas going to say the same, yum makes it very easy. What we need is a Douglas Crockford for PHP. A “PHP: the good parts” and a good PHPlint would do wonders to the language and community.
- sgerrand 15y agoAs previously discussed on HN, Robert Eisele's fork of PHP (at v5.3.6) which attempts to fix many of the issues. http://www.xarg.org/2011/06/php-hacking/ http://www.xarg.org/2011/06/php-hacking/
- Lazare 15y agoTrue, that's pretty easy. But it's also just as easy as getting most other language or frameworks up and running. And since the argument I was replying to was that PHP was good because those other languages are too hard to configure then, implicitly, PHP is too hard to configure - at least for the guy I was replying to. And if you're relying on your webhost having your language-of-choice already configured for you, well, you can find webhosts with most of the obvious choices already configured. So what does that leave? I would suggest that PHP does not, today, have any advantage over other competing languages and frameworks in the "it just works" sweepstakes.
- CJefferson 15y agoPHP's hello world, for transmitting back to the user, is: <?php Print "Hello, World"; ?> I can wrap that in a little HTML, to get valid return to the user. I don't know what Node.js's hello world looks like. From google it looks like the following. This is a heck of a lot more things to understand. // Load the http module to create an http server. var http = require('http'); // Configure our HTTP server to respond with Hello World to all requests. var server = http.createServer(function (request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.end("Hello World\n"); }); // Listen on port 8000, IP defaults to 127.0.0.1 server.listen(8000); // Put a friendly message on the terminal console.log("Server running at http://127.0.0.1:8000/ http://127.0.0.1:8000/);
- _3u10 15y agoYes, PHP is awesome for building hello world applications. No one is disputing that. However, for building applications that might get deployed somewhere, or talk to a database in a secure fashion, it's a nightmare. For ruby, python and perl, it's just as easy to make a hello world like that, all you have to do is execute it as a CGI. Node.js is a FRAMEWORK, not a language, you can equally make it super simple to execute javascript the same way by again executing it at as CGI, it's actually even shorter because you don't need <? ?> tags. The reason the Perl,Python and Ruby communities don't make apps like that is because it's a bad idea. In ruby,perl,python,javascript if you really want to you can. PHP makes it incredibly hard to not be stupid in the way your app is setup. PHP saves you a few minutes of following a rails cast in exchange for a lifetime of hell. The crux of why most programmers disdain PHP is because of the poor choices for maintainability and ease of building larger applications, also because the PHP community has no idea what they're talking about for the most part. Most PHP programmers couldn't even tell the difference between a language, a framework, a template system, probably because PHP doesn't have any separation of concerns. The language, framework, standard library, templating system are all mashed into one godawful mess. But yes, it's really easy to build hello world applications. Alternatively, if you want to build a hello world application you could just write: Hello World in a text file and be done with it instead of exposing yourself to all the security vulnerabilities inherent in PHP. (Yes, even hello world is insecure in PHP)
- 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.