29 ms·
25 Years of PHP
- Mediterraneo10 6y agoRecently I have been thinking about moving my personal blog from Wordpress to a static site generator, because I don't allow comments or use Wordpress plugins. (Those who want comments can still use a combination of a static site generator and Disqus.) It occurred to me that once I did that, I could completely disable PHP on my Apache installation. It made me wonder how much usage of PHP out there is essentially a historical accident, and that if modern static site generators had taken off before Movable Type, the language might have been much less widely adopted.
- innocenat 6y agoDepend on how you count what is static site generator. Dreamweaver has a template system you can use to generate pages. It could probably be considered a WYSIWYG static site generator. I have never used FrontPage, but I would imagine similar system also exists. There are also a lot of other WYSIWYG website editors out there during late 1990s and early 2000's. Despite that, CMS system thrives.
- slantyyz 6y agoOn the "easier to use" front, there was also iWeb and apps like RapidWeaver.
- deleted 6y ago[deleted]
- robjan 6y agoStatic site generators are a niche market, whereas blogging is a mass market. The vast majority of WordPress users probably wouldn't know / care about static sites. WordPress is still significantly more convenient and user friendly for your average user
- slantyyz 6y agoDoes anything like Blogger still exist? Blogger was really easy to use back in the day, and even today, I'd choose it over Wordpress. edit: Context: I used Blogger to publish to a paid hosting service via ftp
- dpcx 6y agoBut Movable Type was written (mostly) in Perl... I'm not sure I see how Movable Type affects PHP all that much, but maybe I'm missing something.
- Mediterraneo10 6y agoMovable Type was popular, but a change in its licensing terms led to people leaving it in droves for Wordpress which had a similar interface and approach. Fast forward to 2020, and Wordpress installations reportedly make up the majority of PHP use in the world.
- dpcx 6y agoIf I'm reading that correctly, the license change happened in 2013... Well after Wordpress was already highly established as the dominant player.
- Mediterraneo10 6y agoNo, the Movable Type license change that drove massive migration to Wordpress happened in 2004.
- wiradikusuma 6y ago"Smarty released. The best-known templating engine for PHP. Rasmus realized that he had done something wrong when people started writing template engines for his template engine in his template engine" :D
- deleted 6y ago[deleted]
- tannhaeuser 6y agoYes. The thing he did wrong IMO was to unleash a scripting language hiding in SGML-ish processing instructions without HTML-aware context-dependent escaping upon the world (when SGML has plenty of rules for delimiter recognition in particular parsing contexts), and then later make up for this with braindead quoting routines (like real_escape_string). In other words, the quick and dirty way was chosen, and that choice has plagued websites in the form of injection attacks (and DDOS using PHP injection attacks targetting even non-PHP sites) to this date.
- DonHopkins 6y agoI strongly agree Smarty is beyond terrible (and I've used it and read the source code, so I know its problems first hand) and the fact that it even exists is indicitive of deep flaws in PHP, but I don't believe Rasmus has ever realized that he did anything wrong. He just doesn't care. "We have things like protected properties. We have abstract methods. We have all this stuff that your computer science teacher told you you should be using. I DON'T CARE about this crap at all." -Rasmus Lerdorf "I'm not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but you're leaking memory everywhere. Perhaps we should fix that. I'll just restart Apache every 10 requests." -Rasmus Lerdorf https://news.ycombinator.com/item?id=20736574 https://news.ycombinator.com/item?id=20736574 DonHopkins 9 months ago | parent | favorite | on: YAML: Probably not so great after all One of the most ridiculous examples of this was the Smarty templating language for PHP. Somebody got the silly idea in their head of implementing a templating language in PHP, even though PHP is ALREADY a templating language. So they took out all the useful features of PHP, then stuck a few of them back in with even goofier inconsistent hard-to-learn syntax, in a way that required a code generation step, and made templates absolutely impossible to debug. So in the end your template programmers need to know something just as difficult as PHP itself, yet even more esoteric and less well documented, and it doesn't even end up saving PHP programmers any time, either. https://web.archive.org/web/20100226023855/http://lutt.se/blog/2006/08/13/why-template-engines-like-smarty-sucks-in-php.html https://web.archive.org/web/20100226023855/http://lutt.se/bl... >Bad things you accomplish when using Smarty: >Adding a second language to program in, and increasing the complexity. And the language is not well spread at all, allthough it is’nt hard to learn. >Not really making the code more readable for the designer. >You include a lot of code which, in my eyes, is just overkill (more code to parse means slower sites). https://web.archive.org/web/20090227001433/http://www.ranting-wolf.info/2008/03/21/php-truth-about-short-open-tags-and-smarty/ https://web.archive.org/web/20090227001433/http://www.rantin... >Most people would argue, that Smarty is a good solution for templating. I really can’t see any valid reasons, that that is so. Specially since “Templating” and “Language” should never be in the same statement. Let alone one word after another. People are telling me, that Smarty is “better for designers, since they don’t need to learn PHP!”. Wait. What? You’re not learning one programming language, but you’re learning some other? What’s the point in that, anyway? Do us all a favour, and just think the next time you issue that statement, okay? http://www.ianbicking.org/php-ghetto.html http://www.ianbicking.org/php-ghetto.html >I think the Broken Windows theory applies here. PHP is such a load of crap, right down to the standard library, that it creates a culture where it's acceptable to write horrible code. The bugs and security holes are so common, it doesn't seem so important to keep everything in order and audited. Fixes get applied wholesale, with monstrosities like magic quotes. It's like a shoot-first-ask-questions-later policing policy -- sure some apps get messed up, but maybe you catch a few attacks in the process. It's what happened when the language designers gave up. Maybe with PHP 5 they are trying to clean up the neighborhood, but that doesn't change the fact when you program in PHP you are programming in a dump.
- lbj 6y agoAmazing how many complete rewrites that timeline contains... :)
- buboard 6y ago3 tbf i have a 12 year old php game that basically prints money - the only thing i had to change was the old mysql module (which was not even buggy/unsafe - just unmaintained).
- atdt 6y agoWhat does it do?
- dpacmittal 6y agoIt says game
- jchook 6y agoPHP has unreasonably good backwards comparability, even between v4 and v7.
- jonny383 6y agoPHP is damn fast now, no joke. And with all of the modern features it's actually not so bad to work in. I'm becoming increasingly puzzled every time I see PHP hate now, especially when I read tired comments like "just use rails". Laravel is arguably as good or even better than rails at this point, and PHP 7+ is definitely light years faster and lighter. One thing that still sucks is package management / composer.
- geerlingguy 6y agoComposer 2 is coming, and so far it’s shaping up to be vastly improved. Also, many people are still using that ‘fractal of bad design’ article from years ago to bash on PHP, even though a number of the assertions are no longer applicable.
- juanuys 6y agoYears ago on GitHub when the new Composer logo was just pushed, I commented (on the relevant commit) that it looks more like a "conductor" than a "composer" or perhaps they meant "composer/conductor" which isn't uncommon in the music industry. My comment was promptly deleted. Oh, well.
- ben509 6y agoThe point of calling a "fractal" and talking about the "design" is that while you can only look at the surface in an article of reasonable length, it points toward strutural and systemic failings within the language itself. The problem is that PHP is built on bad foundations and while many of the superficial problems can be mitigated, the underlying foundations can't be fixed without breaking changes. (Or, as Python proved, even if you make breaking changes, you may still not fix many core issues.) All languages get this way over time, usually as decisions that made sense early on become baggage. But when a language makes poor decisions early on, it accelerates that timeline.
- thinkindie 6y agoyet you don't see articles about how bad python is, it still receive lot of praises and much love. This is telling a lot about how fair are some comments about PHP.
- geerlingguy 6y agoWhat ever happened to the PHP-FIG? I noticed in the timeline projects kept dropping from it in the past 2 years. It seemed to have a lot of momentum for a while producing PSRs that were very widely adopted.
- swongel 6y agoAfaik after the whole PHPixie scandal, they got backlash but the PSR standards they adopted are still in use. PHPixie thread: https://groups.google.com/forum/#!topic/php-fig/cjLBp2weYaA https://groups.google.com/forum/#!topic/php-fig/cjLBp2weYaA
- geerlingguy 6y agoOh my. I lol’ed at the comment: > A big +1 to what Robert said. Let's not be the PHP Drama Group or the PHP Court of Social Justice. It seems like all these “groups that have arbitrary mechanisms for becoming a member and have some sway in the wider community” eventually end up becoming a giant ball of drama and controversy.
- shockinglytrue 6y agoBut doesn't that criteria also describe every open source mailing list ever?
- Ayesh 6y agoThere's so much we can agree upon, right? If you are the geerlingguy I think you are, Drupal sure had an exit after Larry, and Symfony decided to step out too. Laravel didn't really follow PSR to begin with. I use Slim framework extensively nowadays, and it has a surprisingly PSR 2,4,7, AND 15 support. https://github.com/php-fig/fig-standards https://github.com/php-fig/fig-standards The repo is quite active.
- jmnicolas 6y agoOnce or twice a year I have to peak at the code of a PHP app that was developed by interns more than 10 years ago. No framework was used, max 3 letters variables are the norm, no blank lines and the only comments are from code copy pasted from examples. These days I would be more inclined to celebrate the death of PHP than its birthday ! However this app isn't GDPR compliant and I have good hope that it will be gone in about a year.
- methyl 6y ago> max 3 letters variables are the norm, no blank lines and the only comments are from code copy pasted from examples It's hardly PHP's fault.
- elric 6y agoAh yes, the classic "my application is shit so the language must be shit" straw man argument. Sorry to hear you have to work on shitty code. But neither the choice of language nor the lack of framework are to blame. Blame the developers and/or the organizational culture that caused it to be in such a poor state.
- wlll 6y ago> But neither the choice of language nor the lack of framework are to blame. This is partly true. It is possible to make something great with substandard tools. I suspect a master craftsman with a set of dull saws and blunt chisels using his shoe for a hammer will still have the skill to create something pretty good. But it will be frustrating, and most people aren't master craftsmen so what they will produce will be adversely affected by the quality of the tools. If you give most people better tools they will have more chance to create something good. PHP is the rusty saw of the programming world (and yes, I have spend a fair amount of time programming it). You absolutely can create something great in PHP, but the sheer amount of gotchas and edge cases mean that for a lot of people it's hard to produce something good. There are a lot of people out there who aren't master craftsmen at PHP, and this is reflected in the frequency of the low quality PHP application that are out there.
- OwnsE 6y agoFine. After 20+ years of PHP development I'm going to give it a shot. Will be attempting to migrate from VSCode. Any tips for that transition in particular, or for setting up PHPStorm in general? I have a subscription to Laracasts and plan on watching that series, but I'm not sure if it's outdated. Thanks!
- deleted 6y ago[deleted]
- jedieaston 6y agoThere’s a fairly good plugin for JetBrains IDEs called “Key Promoter X” that reminds you whenever you do an action (click build, open a terminal, change directories) of the keyboard shortcut to do that same thing. It’s very handy for getting into the workflow quickly.
- MH15 6y agoJust installed this, it's fantastic! Thanks!
- WesleyJohnson 6y agoThanks for this. I'm not necessarily aiming for mouse-free development, but I've known for years that I could be better with keyboard shortcuts. I had no idea this was a thing.
- mgreenleaf 6y agoI use it every day and love it. Probably the biggest thing is getting the keyboard shortcuts setup how you like and knowing them. - "Search Everywhere" with double tapping shift (at least on mine) is really nice. And the fuzzy file search might be the thing I use most often. - Git support is great, especially the shelving changes support. - I use navigating around words using Alt+arrow-left/arrow-right all the time as well. - "Extend selection" command can be very useful for selecting increasingly larger blocks intelligently. - Go to matching symbol (default Ctrl-Shift-M on KDE keymap) is useful Loads more, I read the daily tips to figure out some of the newer stuff, or look through the keymap. If you like Vim style keys, there's a plugin for that.
- ra120271 6y agoAny pointers at SW that can build timelines in a similar way? I would like to get product roadmaps out in a similar way if it can be kept light weight.
- _def 6y agoI wish more digital subscription models were more like the jetbrains one. If you paid for one year continously they handle it like you own that specific phpstorm version, even if you cancel your subscription. That said, I wish I could subscribe without having a company ._.
- willcipriano 6y agoI have a personal license, you can absolutely subscribe without a company.
- zeeZ 6y agoWhat do you mean? They do offer licenses for individuals, and I've had a personal license for over seven years now.
- agrippanux 6y agoHe might be referring to the UX problem they have on the sales page where it is non-intuitive that you have to click a button to switch to the individual pricing. This affected me recently.
- karatestomp 6y agoHoly shit I was just looking at their site the other day and bounced because the price was way beyond anything I'd consider spending. It didn't occur to me that they price differently for individuals, or that it'd default to showing me organization pricing, and after reading theses posts and checking the site my first guess was that individual pricing would be higher (it's much lower for some reason? Are the org. ones multi-seat? They don't seem to be. WTF.) I'd never have even looked at their site again if I hadn't happened to read these posts. Yikes. They need to call that out much more vividly if they're gonna have weird pricing like that.
- lowercased 6y agoI think the org/business ones are 'seat' - not named licenses. Devs may come and go, but the org can have, say, 8 seats.
- olavgg 6y agoI started with PHP 15 years ago, but after 5 years I just moved to Java. The worst thing with PHP was people and standards, everything was a mess, there was no right way to do stuff and larger projects had like 100 different implementations for the same thing. PHP was really challenging to work with as coming to a shared agreement for how one should implement stuff was a recipe for personal conflicts. So after a few years, I just started to code web applications with Java. A completely different, but much more enjoyable environment and much more friendly people. I guess PHP is much more fun today, it was really fun to code in PHP as it was really simple and you feel productive and powerful. But in the old days, bad defaults often caused issues in production. And some of the documentation/knowledge sharing was dangerous(tutorials lacked warnings and information about preventing SQL injections).
- tasogare 6y agoReading this comment it seems JS is the new PHP, culturewise.
- hanikesn 6y agoSymfony really paved the way for quality PHP code. Excellent Web framework which is a lot of fun.
- cutler 6y agoI could never buy a screen wide enough to display a full path with Symfony. Not quite as bad as its predecessor - Zend Framework - but finding the end of a file path was like jumping down a rabbit hole.
- lowercased 6y ago> A completely different, but much more enjoyable environment and much more friendly people. You must have found a neat subculture in Java - not been my experience at all. The "shared agreement" thing - I've moved between multiple Java environments over the years, and there's never any agreement between companies on the 'right' way to do Java. Open communities in Java - I've often felt they require a huge amount of tribal knowledge of their 'ways' before they'll deign to answer questions in helpful ways. Mention that you can do X in perl or php or ruby, and you're often dismissed out of hand.
- elric 6y agoI wrote a lot of PHP from 1999-2008. First as a hobby, then professionally. From 20 LOC guestbooks to payment gateways used to process millions in payments. It wasn't until recently that I was sure I'd written more code in any other language than PHP. These days I'll occasionally poke around with it or patch a bug, but that's about it. Is it a perfect language? No. But which language is? (I can hear the Lisp crowd grumbling.) It's fast. The only ceremony you need to write executable code is the <?php tag. It has a very rich standard library -- even if some of the function names make me want to stab people. My only real gripe with PHP is the annotation syntax. Yikes. Stuff that's in comments SHOULD NOT AFFECT RUNNING CODE. Who came up with that? PHP has taken a lot of flack over the years. Mostly from people who never really worked with it. A lot of the criticism really should have been aimed at certain PHP developers, rather than the language or the community at large. PHP's low entry barrier is a blessing, it's how a lot of developers were introduced to programming. It's also a curse, because a lot of very inexperienced programmers managed to become prolific at getting code out there, code which was ugly, bug infested and a security nightmare. But it's not fair to attack a language over its inexperienced users.
- hanikesn 6y ago> My only real gripe with PHP is the annotation syntax. Yikes. Stuff that's in comments SHOULD NOT AFFECT RUNNING CODE. Who came up with that? It's a workaround to copy Java's annotations which IIRC also came from javadoc. PHP-8 is adding proper annotations as well. In general being able to add parseable meta information to your code can be quite useful.
- purerandomness 6y ago> Stuff that's in comments SHOULD NOT AFFECT RUNNING CODE. To clarify, comments never affect running code in PHP, ever. What's often done however is that tools like ORMs, or web frameworks offer a 'compile' step that parses these annotations (just like it's common in Java) and dumps a PHP file that maps things in the annotations into actual PHP code. For example, you can use it in Symfony to wire routes to handling functions in controller classes; or in Doctrine to help the mapper wire Entity classes to database tables. If you don't like the idea of preprocessing annotations, you can totally not use them and configure everything using external YAML/XML files.
- joosters 6y ago'This page is best viewed in landscape mode' I don't think I'm going to rotate my desktop monitor just for your website :)
- Intermernet 6y agoYour desktop monitor should already be in landscape mode, shouldn't it?
- aloisdg 6y agoNot if you code a lot. It is not rare for developer to use vertical screen. https://img.devrant.com/devrant/rant/r_200135_Q9Fh4.jpg https://img.devrant.com/devrant/rant/r_200135_Q9Fh4.jpg
- svrtknst 6y agoI mean I'd say it's pretty rare. I've only seen a handful of people do it personally, and I've never seen anyone exclusively use a portrait screen.
- V-2 6y agoWith modern monitors being as large as they are already, I'd say the need for a vertical monitor is likely an indication you're working with spaghetti code.
- richardwhiuk 6y agoWith modern monitors being as large as they are already, I'd say the need for a landscape monitor is likely an indication you are working in callback hell.
- karatestomp 6y agoLandscape monitor just means you tile your windows and prefer scanning side-to-side rather than up-and-down.
- superasn 6y agoI've been working with PHP for a very long time and apart from web it is also very good at writing shell scripts too. One of my recent project called 'howdoi' (1) is written in less than 70 lines of code (ignoring ws) - no libraries, no deps and backward comptabile to 5.0. Just copy-paste the file and it's go! If you know how to use it, it's really useful language. (1) https://news.ycombinator.com/item?id=23230157 https://news.ycombinator.com/item?id=23230157
- ragnese 6y agoI'm really surprised that PHP hasn't picked up in this area. It's a great tool when you're too big for bash, but not big enough for, well, a "more proper" language...
- superasn 6y agoYeah an in-place file-editing feature like Perl or sed has would make it very useful for command line use too.
- slim 6y agobecause it does not feel right to put <?php after shebang. seriously, I hate it. It's like using a wine bottle as a hammer. it works great, try it, but it will never feel right
- elchin 6y agoIf you were starting a project now, would you choose PHP or Hack?
- akie 6y agoWhy would anyone choose Hack? There's no ecosystem to speak of.
- ac42 6y agoHack is interesting and the native C++ interface is a breeze. But choose PHP if you want to live. Hack has only a fraction of the PHP ecosystem and if you mix with PHP, then you lose the advantages very quickly.
- Ayesh 6y agoPHP. Most of the Hack features are now in PHP core, and more and more libraries are dropping support for hhvm now.
- Supermancho 6y agoI do, when I can.
- tasuki 6y agoNo.
- fbn79 6y agoAnonymous function and callbacks in PHP are a mess (Have you ever heard of Closure::fromCallable). Native function name and argument order are a mess with no clear convention. This thinks alone have made me abandon the language a couple of years ago. (I have two Zend PHP certifications and I was using PHP since v.3). Now I'm very very happy with fullstack Javascript (plus occasional TS help).
- elpescado 6y agoLong time ago I was learning Perl, because at that time basically the whole Internet ran on Perl CGI scripts. I thought, "man, Perl is weird". Then I learnt PHP, because whole internet seemed to move to Apache+PHP. I thought, "man, that's Perl done right!". Then I actually learnt Perl, looked at my PHP code written earlier. I thought "WTF?" Now I use Python. I think "man, why I have to type this silly whitespace?"
- tasuki 6y agoI can't wait to see what's next for you!
- BiteCode_dev 6y ago> "man, why I have to type this silly whitespace?" I assume it's a joke, but I often have people in my classroom that have been doing python for some times and that keep typing the whitespaces themselves instead of using an editor that does it for them. But again, I've seen some coding without any syntax highlighting. Now I never assume people know even the most obvious things.
- cutler 6y agoDid you try HTML::Mason or were you stuck with CGI::Application or even plain old cgi? Mason is like PHP but its dependenc on mod_perl made unfortunately made it a non-starter for cheap hosts. Catalyst was an abomination but I think Mojolicious deserves more adoption that it gets.
- Keyframe 6y agoOne thing I really enjoy in JS world is an ability to write both back and front in same language. SPAs now being the norm also puts more weight towards front. PHP had a knack for 'just works' in most cases and will always be dear to my heart.
- k__ 6y agoI started my professional developer career with PHP 5.2 I think end of 2006. While the langugage design was garbage, I the developer experience was quite awesome. This was a curse and a blessing. On the one hand it lowered the bar for many people to get into programming, on the other hand it led many people to believe they can do anything even when venturing in system designs that were much above their pay grade. I switched to JavaScript in 2011 and again, it was mostly for DX. The language felt more light-weight (no $ or classes), while it still had similar problems as PHP and being able to use it full stack eased context switching rather much. Node.js deployments felt much slimmer than setting up PHP with Apache/Nginx too. I still missed a bit of the "drop a source file in a folder and its an API" feeling. Last few weeks I played around with Cloudflare Workers and that got me a bit of the PHP feeling again. I can simply say "This file runs at that path" and be done with it.
- ChrisMarshallNY 6y agoI've written many languages (starting with ML –Machine Language). I'm currently developing in Swift, and loving it. I wrote PHP for about 20 of its 25 years. I never really got to love the language, but got fairly good with it. I don't miss it much. I have used it to write some industrial-scale systems, though. It's a perfectly good language, and is still under active development and improvement; with a vast user base and [m|b]illions of pages of support. Even though a lot of us like to live on "the bleeding edge," I've found that it's a good idea to stick with the classics for shipping code. Nowadays, "the classics" includes JS and Python, so there are definitely good, well-supported, mature alternatives to PHP. I also programmed C++, and ran a C++ shop, for many years. I always find the hate poured onto C++, with the annual "C++ is dead" pronouncement, quite amusing. But I really like Swift.
- cutler 6y agoI tried to like Swift but with Perl as my first language Swift's regex implementation made me want to throw up. That and having to escape opening brackets and double parameter definitions. I just don't get the love for Swift other than it being an improvement over Objective C.
- ChrisMarshallNY 6y agoI consider Perl to be a “write-only” language. Damn good text processor, though. I wrote an entire CMS in Perl, back in the late 90s. I still wake up, screaming... Swift isn’t any worse than most modern languages, when it comes to text processing, but that’s not what I use it for. In fact, it has some very powerful string handling, built-in, but it’s kind of weird, if you are used to more traditional languages.
- cutler 6y agoI never got the "write-only" criticism. If you understand a language thoroughly code is always readable. What's with the insane double param naming? And why do I have to escape and opening paren? No other language requires this.
- bovermyer 6y agoAfter several years now of defaulting to Go, in the last month I've gone back to PHP (specifically Laravel) for a new project. It's... comfortable. That's probably the best way I can describe how I feel about it. I've missed working in PHP, despite how much I enjoy Go.
- zippoxer 6y agoSame. I love Go, the language, much more than PHP, but Laravel.. Laravel is really great. I wish Go had something as convenient and complete as Laravel. Unfortunately that's impossible to achieve in a static language without polymorphism (generics) or metaprogramming. I'm waiting for Go to introduce polymorphism and I'll be watching closely to see how 'post-generics' web frameworks make Go great again!
- atgreen 6y agoI first met Rasmus during my pre-internet BBS days in Toronto, and reached out to him shortly after moving to the Bay Area in '95 when he told me about his pet "Personal Home Page" project. What an amazing trajectory!
- xd 6y agoRasmus Lerdorf look at the last 25 years of PHP: https://www.youtube.com/watch?v=wCZ5TJCBWM https://www.youtube.com/watch?v=wCZ5TJCBWM Really interesting for anyone wondering what the thinking was behind function naming and other inconsistencies jump to: https://youtu.be/wCZ5TJCBWMg?t=987 https://youtu.be/wCZ5TJCBWMg?t=987 and https://youtu.be/wCZ5TJCBWMg?t=1466 https://youtu.be/wCZ5TJCBWMg?t=1466
- fireattack 6y agoYou left out a "g" for the first link.
- JAlexoid 6y agoIf I look from outside - it looks like there was exactly 0 thinking involved in function naming.
- _-david-_ 6y agoThat is the look on the inside as well.
- thdrdt 6y agoMost people don't know this and the timeline also doesn't make it very clear: PHP never started as a language but as a templating system for C. Feature requests were quickly added and that's why PHP became a language with a lot of quirk's. Today that is totally different. As a scripting language it is blazing fast. It still has some strange corners, but it's amazing that a templating system because such a wide used language.
- spicyramen 6y agoGreat language to prototype webpage and backend
- nickjj 6y agoWhile I don't use PHP today, it always makes me wonder at deceptively easy it is to deploy a PHP app. There's no having to worry about restarting processes since the next request picks up the code changes and deploying at scale has so many problems auto-solved by that such as rolling restarts. You can then handle things like percent based feature roll outs at the application level which is likely where it belongs anyways. On the flip side, for single server deploys, you can also get by with zero down deploys without needing to set anything up. Most other languages and frameworks can't do this, or the way they do it involves doing very complicated things or using even more complicated tools to solve the problem for you. It's funny to think back in the early 2000s I was using PHP and deploying was brain dead simple then, but fast forward almost 20 years and it's still pretty much the case today -- at least it seems that way based on the talks I've seen around using PHP in production over the years.
- closeparen 6y ago>There's no having to worry about restarting processes since the next request picks up the code changes and deploying at scale has so many problems auto-solved by that such as rolling restarts. Nearly any serious PHP deployment will use an opcode cache which has to be invalidated, though maybe they are smart enough to do that from the filesystem now. >On the flip side, for single server deploys, you can also get by with zero down deploys without needing to set anything up Mod_python works about the same as mod_php although you are right insofar as most advice is to use a separate uWSGI process. >You can then handle things like percent based feature roll outs at the application level which is likely where it belongs anyways. You want incremental rollout essentially every time you change code; if you feature flagged every single change, you'd have your codebase's entire history all hanging out on master, with far too many possible combinations of feature flags to ever test. The nice thing about rolling back and forth with code is that each version is internally coherent.
- nickjj 6y ago> Nearly any serious PHP deployment will use an opcode cache which has to be invalidated, though maybe they are smart enough to do that from the filesystem now. Etsy has a massive PHP deployment. In one of their talks they mentioned one of the main perks of using PHP is they can just drop code onto a server and be done with it. They are operating at pretty crazy scale. Even deploying to hundreds of servers can happen very very quickly since you don't need to step through a tiered rolling restart. > You want incremental rollout essentially every time you change code; if you feature flagged every single change, you'd have your codebase's entire history all hanging out on master, with far too many possible combinations of feature flags to ever test. Often times you want to restrict features or certain things based on business logic in your app, not just a "dumb" load balancer. For example, you might want to enable new things for specific users who opt into a beta program or maybe only staff to start. But it could also be to a % of users. Usually the idea is to feature flag bigger things and once it's rolled out fully you remove the flag and now it's just something that exists all the time. Of course this depends on your organization tho.
- deleted 6y ago[deleted]
- kingdomcome50 6y agoPHP as a programming language is... okay. And it has come a long way in recent years to become "okay". But frankly, wasting another keystroke regurgitating to tired old "PHP sucks" trope would be to completely miss why PHP is so great (hear me out). PHP as a development paradigm is second to none. The reason to choose PHP isn't because it is such a great language, the reason to PHP is because it gives you the most power for the least effort compared to any platform targeting the web (fight me). PHP is dead simple. I can make a new directory with a single index.php file and view it in my browser in less than 10 seconds. I can then change/add more files, hit F5, and immediately see those changes reflected on my screen. It is the tightest feedback loop possible. I didn't have to remember/rely on any CLI helpers or package managers or debug tools. I didn't have to redeploy or recompile or restart anything... none of the bullshit. Just one file in one directory with zero indirection. And we aren't even done yet! PHP also gives you a built-in web framework out of the box. It automatically parses server/request information and hands it to me for processing into a response. What's that? I don't need a special templating engine to format my output nicely either? PHP is a templating engine! Did I mention routing is also built-in (and transparent) as well? The above is why PHP has become so popular/beloved by so many (and hated by many more). Everyone complaining about the language features ("array doesn't work the way I want it to!") is simply putting their ignorance on full display. There is nothing wrong with wanting something else out of your development environment/paradigm (heck, I've moved on too!), but don't blame PHP because it doesn't conform to your idea of how an application should be written. The above is also why I am so disappointed by the direction the PHP community seems to be taking the language. I am all for improving PHP as a language, but to be honest, I have a feeling the maintainers are going to prove all of those people that claim "PHP is just a worse Java" right... PHP will never be as powerful of a language as Java or C#, and for the reasons I explain above, it doesn't matter! Nobody is choosing PHP because of the language (if they were, they would have chosen Java/C# in the first place). If you want to improve PHP, improve upon the things that make it great. Lean in to templating. Lean in to a more functional approach. Lean in to includes. Screw it, add some more magic! Make the platform more ergonomic. It was always the draw anyway. Who cares about the language...
- dr-detroit 6y agoRIP
- whalesalad 6y ago> They [two startup founders] find PHP/FI 2.0 to be inefficient and lacking features. In 1997 they embark on a complete rewrite of the underlying interpreter. Wild. Doing something like this today would be considered so tangential and risky.
- durpleDrank 6y agoI've been using PHP for most of my web development career (a decade). What are the industry standards for backend web development languages in 2020? I was under the impression PHP was the way to go for back end web development.
- roboyoshi 6y agoI would say golang has been a strong contender for that role for a while now besides the usual java/ruby/python stacks. You can use many languages for your backend, but golang is IMHO the best out there right now (but as always: it really depends on your use-case)
- historyremade 6y agoHidden advertising for Go. Nothing better than good old C++.
- jeffdavis 6y agoI have a theory that PHP is kind of like erlang -- as a framework and dev environment, not the language itself. Each request is pretty much independent of the others, and each one can independently crash. There was also CGI, but CGI always felt a little heavier, and the crashes were harsher (usually just a 501 error and nothing more). PHP embraced the crashes more and provided more information allowing faster debugging. As a result, generally it was pretty easy to make resilient software. Critically, PHP also embraced SQL databases, so that crashing meant aborting the transaction (if any). Erlang never meshed quite as well with transactional databases, so trying to keep consistent shared state in erlang felt tricky. In PHP, it was natural.
- BiteCode_dev 6y ago> Each request is pretty much independent of the others, and each one can independently crash. Not the case anymore with phpfpm.
- jbboehr 6y agophp-fpm uses a worker pool. How is this true unless you corrupt the shared memory segment?
- BiteCode_dev 6y agoI haven't checked it, but I think the worker stays up, and deal with several requests during its life time, not just one then die. Hence, there is pesistence.
- jbboehr 6y agoAs long as there is nothing broken in internals (a very big if, to be fair), user code crashing will not affect subsequent requests.
- deleted 6y ago[deleted]
- p2detar 6y agoI’m thankful for PHP. I don’t use it on regular basis or even as my main programming language, but I do use it for side gigs and smaller projects to earn extra cash. It’s fast, easy to get into and does the job for me.
- coliveira 6y agoMany people here don't understand the genius of Php. The language thrives of the ability to put out functionality that can be easily used by as many people as possible, even if it is not polished or technically perfect. This raises the ire of lots of programmers from "serious languages", which will usually take years to figure out the best syntax, the perfect framework and tooling environment, etc. While they're doing this, Php programmers are writing billions of lines of code to support millions of websites all over the world. Like many others, I sometimes hate the ugliness of what comes out from Php, but there is no question that it works to get the job done without having to learn the thousandth latest framework for language X.
- tzs 6y ago> PHP to have str_contains() A function that checks if a string is contained in another string? That should only take about 25 years. For anyone else confused by the newest thing on the list who is wondering what the heck str_contains() does that you could not already easily do with strstr() or strpos() since time immemorial, the answer is nothing. The only difference between str_contains($needle, $haystack) and strstr($needle, $haystack) and strpos($needle, $haystack) is that after they all make exactly the same C function call: php_memnstr(ZSTR_VAL(haystack), ZSTR_VAL(needle), ZSTR_LEN(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack)) which returns either a pointer to the needle string in the haystack string or NULL, • str_contains() return false or true, depending on whether that pointer is NULL or not, • strstr() returns false or the part of haystack starting with needle, depending on whether that pointer is NULL or not, and • strpos() returns false or the offset of needle within haystack, depending on whether that pointer is NULL or not. It's equivalent to just writing (strpos(...) !== false) in your current code. The rationale for adding str_compare() is that strstr() and strpos() are not intuitive, easy to get wrong, or hard for new developers to remember.
- Cthulhu_ 6y agoI personally don't object to 'trivial' functions sprinkled in my stdlib. I mean your own comment already highlights it, the return value of strstr() and strpos() is not intuitive, whereas you expect a boolean for a 'contains()' function. Of course, it also highlights one of PHP's often repeated criticisms, that of function naming inconsistency.
- deleted 6y ago[deleted]
- dzonga 6y agoI'm not a php developer - syntax ain't for me. but props to these folks man. 25 years of getting shit done. shipping, amidst the jeers. I look at Laravel as one of the big 3 web frameworks to use if you're serious about shipping stuff. & in the PHP world, everything has been done - so you won't be doing anything new.
- lux 6y agoIt's so crazy to see how far the language has come, and how much it's matured! I started working in Perl around '98-99, switched to PHP in 2000 just after PHP 4 came out, and ended up running a company around it for all of my 20's. Very thankful for the language and community that made that possible. These days I still write a fair bit of PHP, but mainly C# and Go, and some Javascript. I understand the criticisms of each language, but I don't mind the type inference/coercion in scripting languages and don't find it actually results in that many bugs. Although I do appreciate the clarity of choosing your types and understanding their performance implications in C# and Go. I guess it comes down to the right tool for the job, and some jobs do just fine without strict types. Since 7, PHP's also gotten fast enough that most web-related tasks are just faster to solve with it, and it's so easy to deploy a Go binary alongside it for performance-critical parts that it feels like a killer combo in terms of productivity vs performance. Really itching to play with Roadrunner next, which blends those two together into a single app server (https://roadrunner.dev/ https://roadrunner.dev/).
- didip 6y agoI gotta say... PHP has grown so much and growing further in the right direction (with union types and async I/O). At the speed of its improvements... it's kind of embarrassing other dynamic languages (I am looking at you Python, even though you are one of my favorites).
- arpa 6y agoWhy is it so that PHP attracts condescending assholes like shit attracts flies?
- savethefuture 6y agoAre you referring to the people who like to hate on it or the people using it?
- arpa 6y agoThe people using it, in my experience, have good humour about the numerous quirks and downsides of PHP.
- at_a_remove 6y agoIt has been a long time since I have had to deal with Other People's PHP and I have never had to with my own. Mostly, I have had to at least glance over student projects that had security issues I could drive a bus through, honking and dragging a bunch of rusty bikes. In terms of language design, I couldn't speak to it. I've never designed a language and they are intensely personal things. However, I have the vague sense that the culture of PHP (installed by default, easy to get working) created many fire-and-forget projects done to scratch an immediate itch with no sense for maintenance. It works? Ship it. You can write obfuscated code in any language, but some languages have a culture which encourages it, such as Perl. Similarly, I think many perceptions of PHP arose from a "make it work, now, anything else is someone else's problem later" mindset I saw from the people who were developing in it. I would be interested in other perspectives.
- racl101 6y agoMay not be the prettiest language out there but it ALWAYS pays the bill.
- rawoke083600 6y agoIf it's THAT bad.. why is it still around and under active development 25 years on ? Sure COBAL is also still around but the amount of new projects started in COBAL vs PHP is a lot less.
- BiteCode_dev 6y agoBecause technologies don't win by being the best, or even by being good. They just need to provide a killer feature and an easy path to adoption. After that, inertia does the rest.
- gtm1260 6y agoAs a new web dev who's never learned PHP, is it worth it? I don't really need to write anything into production.
- iimblack 6y agoAs another newish web dev, I think it depends. Best thing is to take a look at your local job market and see what people are using. In my area it's a lot of .Net, so I'm focusing more on that. Some other areas have lots of PHP jobs, others have Rails, etc. If you don't care about any of that, I still probably wouldn't pick PHP honestly. I went with Go for my toy project backend, but NodeJS is another good option I think.
- asadkn 6y agoAnd WordPress, which is hated even by PHP devs, continues to grow now powering 37.3% of all websites [1]. Until last year, it maintained compatibility with PHP 5.2 essentially relying on PHP of the 2007 (now bumped to 5.6 which was released in 2014). [1] https://w3techs.com/technologies/overview/content_management https://w3techs.com/technologies/overview/content_management
- hivacruz 6y agoWhat I love about PHP is its learning curve. You can quickly start making things. I started two decades ago with dirty PHP mixed with HTML pages, then I learned templating. Then I learned OOP, classes, interfaces, abstract classes, traits, managing dependencies and unit tests. All of these with PHP, no framework. Because PHP is quite easy to use, I learned all these "general" principles thanks to it. I guess nostalgia plays a big part in my appreciation of this language but I will just say one thing: thank you PHP!
- unexaminedlife 6y agoI think probably the most ironic thing about all the hate PHP gets, is that those who hate it the most seem to assume that the people who chose to use it did so without exploring other options. So {your favorite language here} was turned down by a potential developer because they saw PHP as the better option. People aren't stupid but from all the rhetoric it seems the "geniuses" in the group think they are. I wish I could request a POLL here. I'd ask, from all the people who hate PHP and write extremely long posts about their hate for the language: How many of you used some of that energy you expend hating PHP to write a patch or feature for your favorite language to make it more desirable for other developers?
- AndyMcConachie 6y agoThere are only two kinds of programming languages. Those that everyone hates, and those that no one uses. Everyone hates PHP.
- 0_gravitas 6y agoWhat I tell other people what it's been like working with PHP, it's usually this: "Working with PHP is like having a crazy guy with a gun on your side, by his nature he is powerful and potent, and you can definitely get a lot of stuff done with him... but who the hell gave this guy a gun?"
- brian_herman__ 6y ago"PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil, perpetrated by skilled but perverted professionals." -Jon Ribbens. Programmer.
- omnimus 6y agoPHP is still dominant in CMS space. If you are writing webapps use something else. But if you are working on content then PHP CMS ecosystem is just way ahead of everything else. You almost can't afford to go around it. And I dont mean Wordpress. Modern CMSes like Craft, Kirby, Twill or even things like Bolt, Processwire or Grav... they are pretty great mature platforms for custom content websites and basic CRUD. Hell with Wordpress (which i hate) and some plugins you get your own self hosted website builder ala Squarespace. PrestaShop and OpenCart are solid ecommerce solutions. It's too dirty and DIY but it gets job done for most small to medium size businesses.
- hugozap 6y agoI believe PHP will still be relevant and a lot of the fancy frontend frameworks out there won't be around anymore. Some kind of lindy effect in place.
- KerryJones 6y agoI first heard about the Lindy Effect from Nicholas Taleb -- for those who don't know it: The Lindy effect is a theory that the future life expectancy of some non-perishable things like a technology or an idea is proportional to their current age, so that every additional period of survival implies a longer remaining life expectancy.
- niyazpk 6y agoI haven't looked at PHP in ages. Now that I hear that the latest version are much better, does anyone have links to good quality PHP code that I can take a look at?
- BilalBudhani 6y agoI taught myself PHP back in 2007 as it was the only language which had a single click installer (WAMP) & easy tutorial to learn (w3schools) to get started with programming. Since then I wrote a lot of PHP, initially for myself then professionally once I got a good handle on it, until 2012. Now I'm again thinking of picking up PHP for my side projects because of Laravel.
- gotzmann 6y agoI kinda prefer PHP for most of my web backends like yet another REST API. Modern framewrok like Comet easily beats any NodeJS or Python project regarding performance and latency: https://github.com/gotzmann/comet https://github.com/gotzmann/comet