5 ms·
Man, this got so much flack from the PHP community that didn't see the power in having a built-in webserver. For some reason, people center on that it's suppose
by stevencorona 14y ago
Man, this got so much flack from the PHP community that didn't see the power in having a built-in webserver. For some reason, people center on that it's supposed to replace Apache/nginx, which it's not.
Languages and frameworks aside, one of the nicest and most newbie friendly parts of Rails is that it's bundled with a webserver, so you can start playing around without having to setup any sort of dev environment.
Edit: I do agree that this should probably not be in the core php interpreter, though. Ideally, it would be a PHP library with a CLI utility, but with PHP's poor culture and adoption towards shared libraries ala composer/rubygems/npm, I think this is the best alternative.
- ceejayoz 14y agoPrecisely. This will hopefully replace a lot of the "FTP it up to the server, see if it works" workflow I've seen in the PHP world.
- drbawb 14y agoTo be honest: that was quite possibly the greatest part of learning PHP for me! PHP was the first language I learned; the fact that I could deploy it to nearly any shared host [of which there were a lot of freebies] allowed me to rapidly program and debug; which I find was crucial to my initial learning. Hindsight being 20/20: of course I agree with you, now. But I'm still not convinced that young me would've been able to use the built in server. I certainly couldn't be bothered to setup Apache (et al) and a working PHP interpreter. Rails is a bit different, since you learn about the built in webserver when going through their "hello, world" tutorial. If excellent tutorials surface for PHP, then perhaps I can see the "FTP-to-test" pattern being obsoleted. To me: PHP's greatest asset was that A) I didn't have to setup my own development environment, and B) there were so many [free] development environments already setup! I'd learn to love setting up servers, but that came far later [in my chronology anyways]. tl;dr: FTP and common PHP setups actually removed a large barrier to entry for a young programmer. I think the "FTP-to-test" anti-pattern was probably one of the more useful ones in my toolkit when it came to my initial learning.
- geofft 14y agoWait, running the built-in server is one command (and no configuration), and it's quite reasonably claimed that Rails' equivalent built-in command is helping the adoption of Rails by people who are now in the position where you previously were. It seems to me like it should be at least as easy to fire up the built-in web server as to learn FTP and sign up for some random shared hosting account, right? That is to say, isn't this even a lower barrier to entry than the FTP approach?
- slig 14y agoI doubt it. People that do this kind of shit won't have the DB installed locally.
- deleted 14y ago[deleted]
- nateabele 14y agoSeriously. How great is it that anyone with PHP installed can get up and running from a git repository in literally 3 commands?
- maratd 14y ago> I do agree that this should probably not be in the core php interpreter, though. It isn't. From the page: "As of PHP 5.4.0, the CLI SAPI provides a built-in web server." It's part of the CLI SAPI. That's the command line interface to the PHP interpreter. Which makes sense, since that's the only place you'll use it. So if you're using CGI, FastCGI, Apache module, or any other SAPI for regular PHP work, that code is not being loaded. I'm also pretty sure you can turn it off during compilation of PHP, making it easily removable.
- timdorr 14y agoYep, you can turn it off: ./configure --disable-cli The CLI is enabled by default, so most distros have this built-in if they have a PHP 5.4 version available.
- deleted 14y ago[deleted]
- Legion 14y agoI upgraded my local Ubuntu install to PHP 5.4 solely to take advantage of this. We write Rails apps at work mostly these days, but still have some PHP apps floating around. Now, instead of having to configure something like Apache just for local development, I've added Procfiles for Foreman to these projects for firing up the PHP webserver along with the rest of the processes the app needs. Much nicer, much more in line with what I enjoy over in Rails-land every day.