6 ms·
...to this day, I still can't wrap my head on how PHP even got to exist in a world where Perl was already filling the web niche just fine. Also, if they wouldn
by catchclose8919 4y ago
...to this day, I still can't wrap my head on how PHP even got to exist in a world where Perl was already filling the web niche just fine.
Also, if they wouldn't have made it too-weird-for-math-and-physics people, Perl would've probably filled Python's niche too.
And with that kind of resources focused on it, Perl 6 could've actually turned up into a clean nice new language that would've unified us all by also supporting nice compile-to-wasm.
</alternative-reality>
- deleted 4y ago[deleted]
- tombert 4y agoI'm speaking completely out of my ass here, but my suspicion for why PHP took over the web is largely because it was "web-first". It was free, open source, and you wrote directly on HTML pages, instead of Perl spitting out HTML via CGI. I think ColdFusion was briefly popular for the same reason (though I think that one fell out of favor largely because it cost a ton of money).
- 0xbadcafebee 4y agoPeople see a tool designed for one specific purpose, assume that must be the best tool for the job, adopt it, then more people do, then it gets popular, then people adopt it just because it's popular.
- Arathorn 4y agoIt's easy; PHP is/was: <html><body> <?php echo 'Hello World'; ?> </body></html> Whilst the equivalent Perl at the time would be: #!/usr/local/bin/perl print "Content-Type: text/html\r\n\r\n"; print "<html><body>"; print "Hello world"; print "</body></html>"; or possibly... #!/usr/local/bin/perl use strict; use warnings; use CGI; my $q = CGI->new; print $q->header('text/html'); print $q->start_html(); print "Hello world"; print $q->end_html(); ...if you were being a bit more more fancy. In other words, there was no standard templating; Template Toolkit eventually became a relatively defacto standard, but PHP had already won - and even then, TT had to be manually invoked rather than just going and freestyling <?php> tags everywhere in your HTML and "it just working". In every other respect Perl is & was superior to PHP, and it's really sad to see Perl fade, despite (or because of?) its crazy flexibility and power.
- hedora 4y agoWith your first example, there was no easy path to compatibly handling form requests. Web browsers really sucked back then. As I understand it, PHP became popular before CGI.pm was ready.
- thatwasunusual 4y ago> As I understand it, PHP became popular before CGI.pm was ready. CGI.pm was created long (...) before PHP was released.
- nrdvana 4y agoWas CGI.pm ever "ready"? Modern Perl releases dropped it because it was such a bad design.
- tomc1985 4y agoPretty sure there's a way to load perl as a webserver module like PHP, then you can do that embedded stuff too
- jerf 4y agoYes, but that stuff came later. It's actually the first way I used Perl on the web, but by then PHP was off to the races. You could even get modules that would allow you to inline Python just like PHP, although the interaction between that and mandatory indentation could get a bit "interesting". Also perhaps ironically, this style of mixing code and HTML has generally come to be regarded as an antipattern. PHP may still be able to do that, but woe unto the project that wants to write tons of code that way. But it's still the foothold PHP used to wedge its way into at least the B tier of languages.
- tomc1985 4y ago> Also perhaps ironically, this style of mixing code and HTML has generally come to be regarded as an antipattern. Tell that to the React world :P
- incanus77 4y agoI’ll tell you why it appealed to me. I started programming web systems in ‘96, with Perl because it was on every machine and every web host. Apache mod_perl was a thing, and it was a bad thing, because it had to be restarted all the time because of memory leaks. On the other hand, mod_php was much more solid, and additionally, at the time, MySQL was the main thing for many websites. The Perl database bindings were wordy and obtuse, but PHP was a breath of fresh air. I was able to start using it in environments in ‘99 and honestly, I’ve never looked back at Perl as a web application language, just a systems one. That simple difference was enough to make me fully switch over, and it set me on the path of a career programmer, so I look back on that time very fondly. One other thing: I don’t recall Perl scripts allowing C-style pre-processing inclusion the way PHP did. I worked at Linux.com around then and we used all sorts of templating and other library reuse via this inclusion.
- dunefox 4y agoIf we're speaking alternative realities, I'd like to live in the one where Lisp took over instead of Java/C++...
- influx 4y agoAs I recall, PHP just seemed blazing fast compared to Perl, and most web hosts already had it installed in Apache. Further, many web hosts didn't even allow CGI due to security issues.
- toast0 4y agomod_perl was stateful and mod_php was stateless. By that I mean, a mod_perl program was expected to change the execution state for future executions, global variables would remain, etc. There are ways to make that happen in mod_php, but it isn't the default and I don't know if they were available initially. This made it easier to share a mod_php server with many users... A mod_perl really should be suexeced per user (or something) and that's hard. Really, you want to do per user php servers too, but it wasn't obvious back then.
- mekster 4y agoEveryone was just starting out at pre 2000. Perl was scripting first but PHP was HTML first, as in plain HTML is still a valid PHP and it was easy for people to pick up without having have to see some weird error without the content-type "magic" line and setting the file to "777" to get it working. But I do like its Unix feeling. Too bad no one uses it anymore and have to move on.
- daotoad 4y agoThe reason was shared hosting. Most of the really good Perl options for application building used mod_perl which did not play well in shared hosting environments. If you could find a host, you were still somewhat at their mercy for getting modules installed, which was a huge pain in the neck. Conversely, PHP was trivial to set up for safe shared hosts. The end result was that Perl hosting was expensive and had a higher barrier to entry than PHP.
- cutler 4y agoPerl tended to follow rather than lead which is why it lost to its competitors - first PHP, then Ruby and Python. For example, Ruby had its own server interface - Rack - long before Tatsuhiko Miyagawa developed a version for Perl called the Perl Server Gateway Interface (PSGI) upon which Plack was built but Ruby was off to the races with Rails by then.