I used to feel the same way a lot of times, a shame it seems for being a PHP dev. Now, I don't care. I've been using it since 1999, and I use it to get stuff done.
My customers and users of my applications don't care what it's written in.
But, you should definitely learn more languages as a programmer.
> And to anyone considering programming as a career, or trying to get into it... stay away from PHP.
This is the part I disagree with the most. The language is getting better and better with every release. It's incredibly fast, much safer to use (the Error exception type, scalar static type hints, all the garbage from the early 2000's has been removed), and easy to work with. The ecosystem (with the introduction of Composer) has _completely_ changed and reinvigorated the language. It's easily one of the best package managers out there. I definitely recommend giving PHP a look or a second change if you've written it off.
Unfortunately, the issues aren't with "new" PHP, it's with the mountains of "old" PHP code that invariably finds its way into your project.
Also, having had to maintain a Wordpress site the past few months, may God have mercy on all daily Wordpress devs. I truly admire your stalwartness now in putting up with that.
The problem is that clients really want WP a lot. Bigger and bigger companies currently and for most of their departmental sites. This is WP shoe-horned in a full site CMS function. The thing is, users seem to love it. I would wager that if you just rip out the guts of PHP and leave only the frontend (the /wp-admin part that is), but leave it 100% as it is and write a solid backend in Django/Rails, you have a winner. The problem is that when people attempt this, their own 'taste' comes in and it always ends up being a vastly different frontend which then users don't want as it's not 'the same as WP'.
Before anyone says it; sure some users use WP for the themes and plugins; we use some of them but we are very careful using plugins. They have to be rocksolid for many years, actively supported and we have to have reviewed the code. Next to that they have to add something significant; installing a plugin for some social buttons is very much not worth the pain of updates / security breaches on a 100k+ (+ SLA) project. And so in the end we end up using 4-5 the same plugins for projects and the rest is either not needed or easy to implement anyway. So the hero implementing those guts in Django/Rails could also implement those plugins. I believe you would have something safe for the enterprise. Until then, they'll just use WP and trust admins/coders to fix the issues.
> I would wager that if you just rip out the guts of PHP and leave only the frontend (the /wp-admin part that is), but leave it 100% as it is and write a solid backend in Django/Rails, you have a winner.
I would love for WP to exist as only an admin interface to a clean, backend data store. Unfortunately, the problem is the database schema that WP ships with and the way WP handles data. It's almost impossible to get data out of WP press without using its lackluster DB "abstraction" layer and running the fetched data through its many obscure filtering mechanisms. To top it off, WP smashes everything into a handful of tables and makes doing normal, straightforward relational looks up (as any sane schema would allow for) a complete nightmare. Alas, when you go the WP route, your data is very much dependent on WP (and by default PHP).
Any organization that uses WP for an extended period of time and builds up a non-insignificant amount of data will run into this wall, guaranteed. If you truly value your data and your project is anything beyond a personal blog that you'll give up on in 6 months time, do yourself and your organization a favor and find an alternative solution. If you must use WP, use it as what it was originally intended for: a blog. It's not a framework to develop a complex application off of.
As the person who wrote a patch to import data from WP to Pelican I agree. It's a complete nightmare. In order to properly maintain the formatting from ~6 years of blog posts I had to literally translate the PHP code that parsed the database representation into Python... which is some really gnarly code.
Have you looked at/heard about the WP REST API[1]? Basically, it allows WP to function as that backend admin tool that you talked about, and you can build the front end as what ever you want[2].
I agree with everything you said here but I can explain this to clients usually however not always. There is, for instance, a supermarket chain running all their web through WP. They spent and spend millions on it; they cannot be convinced and although I might not choose a certain tech for my own company assets, I am not spreading religion (although as I get older I feel more and more the need to do so) and we are not in the position to just say no to large contracts.
> The problem is that clients really want WP a lot.
This. I can waste my breath talking about another CMS which is better suited for the task, has cleaner data representation (good for 5 years' time) etc, and try to get stakeholders to buy into it. Or I can mention WordPress and have brand recognition do the work for me.
> The thing is, users seem to love it.
In my experience, the users find the admin confusing. It's the managers and above who love it. They know what they're getting and it feels safe.
It used to be "You're never fired for buying IBM". Now it's "You're never fired for buying WordPress".
> In my experience, the users find the admin confusing.
My 'entry' into the enterprise world was web CMSs; my previous company used to make/sell a respected web CMS. If you talk about 'confusing admins' then the web CMS world is where you should look. Boot up a Liferay (oh and check out that code by the way) or Alfresco or Sitecore or Oracle CMS and stare in disbelief.
This is what these users are used to and compared with those, WP is really very simple. That's why no (?) enterprise will replace an international corporate roll-out with WP, but regional, if allowed (and it usually is as marketing simply doesn't work the same way worldwide), they will. Because of the ease and less friction; create a new content writer? Fill in paper work and ask the main IT dep vs do it yourself in 5 seconds and that kind of thing.
"old" PHP code should not be finding it's way into your project. Use a facade, adapter, proxy or bridge pattern to decouple your new shiny awesome code from the legacy cruft.
I understand that the negative pressure can have a long term effect. Personally that has never gotten to me and it's sad for the author that they have been slowly worn down over time to a breaking point.
I totally agree with "But, you should definitely learn more languages as a programmer." In my current position I led a ground up build in Python/Django after 10 years of personally using PHP. I learned so much that I wanted to bring back to the PHP stack, only to find that the PHP community is already working on those things. It's really fun to see the parallels.
I am a strong believer in coding fundamentals and try to preach language agnosticism to my team. Yes there is often a right tool for the job, but in many cases the major platforms will be able to achieve the problem at hand – at least for typical problems.
If you're a PHP dev, you really ought to add a complementary language, not one that, like Python, is really quite similar when it comes down to it in terms of performance, execution model, language features, etc. There's a lot of good options out there and there's more coming every year now. Go is a nice choice because it really nicely complements PHP, being good at some things that PHP is bad at, and PHP being good at some things Go is bad at. Rust might be a good choice with just a bit more web dev work on it. Erlang/Elixir, Clojure, something with a great concurrency story, an easier time getting to high performance, and some (good) static typing for when you're in the code where that's a good idea, that sort of thing. PHP->Python is not a bad thing necessarily, but it's not really "diversifying" very much.
Resume driven devlopment. As you say PHP and Django are similar in what you can use them for. I would choose either of the over Rust for a standard web app. Unless you have a specific need for concurrency, the PHP and Django are far more mature in the web app space.
It is far worse I would say. Legacy PHP code is some of the worst code I have seen in my life. Everyone with HTML/JS knowledge could also do PHP and they did. There are many production systems (banks, insurance etc included) running old style php with html mixed with php mixed with JS. And it runs fine, but if you need to fix something that broke or had to be changed...
I have seen some real crap in Python recently. Then I was asked to move a PHP app to a new server. A quick look at the code looked terrible - string concatenations for all the SQL. (Does PHP provide some way of making this safe, or should I warn management about potential SQL injection? I don't know a lot about PHP).
I also disagree strongly with that piece of advice. Even though, as others have pointed out, if you become a PHP developer you're going to have to deal with nasty legacy code; there's nasty code written in Ruby, Java, Python, etc. too. It's just nasty in a different way.
PHP is actually the language I do recommend people learn if they're interested in web development (obviously along with JavaScript), because PHP developers are in high demand. PHP developers can always find work, precisely because there is so much PHP out there.
My customers and users of my applications don't care what it's written in.
But, you should definitely learn more languages as a programmer.
> And to anyone considering programming as a career, or trying to get into it... stay away from PHP.
This is the part I disagree with the most. The language is getting better and better with every release. It's incredibly fast, much safer to use (the Error exception type, scalar static type hints, all the garbage from the early 2000's has been removed), and easy to work with. The ecosystem (with the introduction of Composer) has _completely_ changed and reinvigorated the language. It's easily one of the best package managers out there. I definitely recommend giving PHP a look or a second change if you've written it off.