5 ms·
I like PHP. Right, yes, I know, that makes me crazy, but modern PHP is a fine language. HHVM, Hack, Composer, Packagist, the PSR standards: all of that comes t
by girvo 12y ago
I like PHP.
Right, yes, I know, that makes me crazy, but modern PHP is a fine language. HHVM, Hack, Composer, Packagist, the PSR standards: all of that comes together for a nice development workflow. PHP's shared-nothing architecture by default makes horizontal scaling an exercise in simplicity.
But: I don't like WordPress. Yes, it can autoupdate -- and that's certainly better than how things were prior, however WordPress' core code is horrendous. There's a reason why security issues are consistently found.
The bigger issue is the sorry state of most plugins; the bulk of vulnerabilities that end in compromise of WordPress sites are not from the core itself, but the plugins. An autoupdater for those certainly exists, but it doesn't help you if the people writing the plugins to begin with have no clue how to write not-insecure software.
These days, I avoid WordPress like the plague. When I do have to work with it, I've dragged it kicking and screaming into 2015: It lives in a Docker container, is fully 12-factor, completely managed through Composer (including Wordpress' core itself) and all code that I write for it is proper unit tested, PSR-4 autoloaded namespaced classes; this allows me to avoid crappily written plugins and rely on battle-tested libraries instead.
If and when it gets compromised, I can restore the Docker image within seconds, or lock it down as straight HTML by exporting it as a static site temporarily. WordPress can be decent if forced to be, but it's a lot of work and I'd much rather use something that doesn't have so much cruft clogging it up.
I mean heck; you still can't run the latest version of WP on anything other than MySQL, despite technically having a DBAL. Absolutely crazy, considering we have Doctrine or Propel!
- PebblesHD 12y agoFear not, PHP when used appropriately can be fantastically useful. Pretty much every argument against it that I've read has centered around trying to do something it wasn't meant to do and not being very good at it. As a web scripting language, it works as advertised :-)
- pyre 12y agoI've heard that it's not very good at the "web app" paradigm vs. the "cgi script" paradigm that it was created in. Is that really true?
- girvo 12y agoNot in 2015 it's not! Front-controller pattern (single index.php, in the same way you'd have a single Python process that Nginx talks to) that hands off to something like Silex or Symfony or Laravel, and you have a beautiful base for a proper web application API layer -- autoloaded classes, proper dependency injection, and more.
- fsk 12y agoI never liked the pattern of routing every single request through index.php. I prefer to let Apache do the routing for me, having a separate script for each task. I also had a PITA debugging someone else's code with autoload magic. He didn't follow any pattern for what code was in which directory, and he reused class names so grep didn't work. Now where is that source file again? (In one particular abomination, he took a string from the database and included that source file.) That's one nice thing about PHP. You can use PHP for a simple straightforward style, or for an abomination like zend. Vanilla wordpress is good. I'm working on a project that has a custom framework that lives on top of WordPress, and I'm cursing the people who wrote it and my employer for outsourcing the WordPress project to them.
- vectorpush 12y ago> He didn't follow any pattern for what code was in which directory, and he reused class names so grep didn't work. Now where is that source file again? http://www.php-fig.org/psr/psr-4/ http://www.php-fig.org/psr/psr-4/
- imakesnowflakes 12y ago>PHP when used appropriately 'using php appropriately' involves keeping a large number of gotchas and weird behaviors in your head, when you are writing every single line of PHP.
- pcunite 12y agogiro, I agree, but what are the alternatives? I'm coding my own, personally.
- 8ig8 12y agoKnowing about WordPress and the typical use case, what do you use instead?
- ceejayoz 12y agoMost people would be fine with a static site generator like Jekyll and a third-party commenting system like Facebook or Disqus. As a bonus, it costs pennies to host such a thing on S3.
- jacques_chester 12y ago> Most people We in technology are not "most people".
- mikeschinkel 12y ago+1
- ceejayoz 12y agoAnyone who can manage a WordPress install should be able to get Jekyll working, but I'd like to see it get a user-friendly GUI that takes care of the grunt work.
- 8ig8 12y agoI'm not necessarily here to defend WordPress, but, I agree, a compiled static site does make sense for the HN user's blog, but you're not typical. What about the neighborhood barbershop that needs a website and likes to self-publish blog articles a couple times a week? What's the best solution for them?
- ceejayoz 12y ago> What's the best solution for them? I'd love to see a user-friendly GUI backed by Jekyll.
- sluckxz 12y ago
- JonLim 12y agoHonest question: for the rest of us who can't write our own blogging platforms but are able to roll out our own hosting for a blog, which one would you recommend?
- dotBen 12y agoWP Engine (http://WPEngine.com http://WPEngine.com) laregly solves any of these lingering concerns, or makes them irrelevant. It is also relied on by many, many Fortune 500's through to YC Startups. (Disclosure, I'm a confounder but not actively involved in the company these days)
- JonLim 12y agoVery familiar with WP Engine! However, my question was more around what other platforms can I set up on the hosted space I already have, rather than paying for someone else to host my WordPress blog. Thanks though!
- thesimon 12y agoNot OP, but http://jekyllrb.com/ http://jekyllrb.com/ and ghost are both great.
- JonLim 12y agoI've been aware of Jekyll, but I never gave it any serious consideration. Maybe I should go ahead and do that now. Thanks!
- NDizzle 12y agoI was wary of the Wordpress auto update changes starting with I think 3.8. Right out of the gate they updated the $post object in a way that broke existing installations. That was what got me off wpengine and off wordpress entirely. I was tired of the updates breaking existing functionality in a way that made me have to think about it.
- imakesnowflakes 12y ago> modern PHP is a fine language. I am sorry, but bolting on a ton of 'modern' features on a broken language does not make it not-broken. If it does anything, it is to put up an appearance of being modern, while remaining rotten on the inside, and hence all the more dangerous. Remember, the most broken aspect of the language is also reason for it's very defining feature (No or very little learning required to get started). Hence one cannot hope that PHP will be fixed at some point in the future. Because fixing the language thus will actually involve killing it and designing it from the ground up, at which point you can just use Python 3. And that is even considering that the PHP community is competent enough to identify the flaws of the language. But I think what happens inevitably is that, people who can really see how broken the language also see the hopelessness of the situation and immediately switch to something else or use it only to pay their bills. If you think I am not familer with modern PHP, here is a tool I wrote some time back in php, for php programmers to deal with the pain of working with namespaces and also provide intelligent auto completion for editors like vim.. https://bitbucket.org/sras/cliche https://bitbucket.org/sras/cliche
- girvo 12y ago> If it does anything, it is to put up an appearance of being modern, while remaining rotten on the inside, and hence all the more dangerous. But what's rotten that you have to use in the day-to-day? PHP still has it's quirks, sure, but when I write modern PHP nearly all of those melt away. Also, well done Cliche, that's pretty neat; there are some other implementations of this idea nowadays that do similar things and are very useful.[0] One of the reasons I love HHVM is that Hack is basically PHP-the-good-parts-with-other-awesome-good-parts-added. Static analysis? No problem. Autocomplete? Built into the default tooling! Having to remember dirty array method parameter ordering? No need -- use Collections and use methods on the primitives! [0] https://github.com/nikic/PHP-Parser https://github.com/nikic/PHP-Parser
- JeremyMorgan 12y agoI'm with you. Though I'm a .Net developer by trade I spent years in the PHP trenches. C# and .Net provide better solutions in my opinion for the enterprise. But for shops with low funds and projects that needed to be done yesterday, PHP really shines. It's not the language as much as it is the programmer. I've seen some very secure, well written programs in PHP.
- jcroll 12y agoAre there any examples of someone trying to refactor Wordpress on the Symfony HttpKernel or basically moving Wordpress Core to some type of more modern architecture?