The PHP Singularity

Look at this incredible thing Ian Baker created. Look at it!

What you're seeing is not Photoshopped. This is an actual photo of a real world, honest to God double-clawed hammer. Such a thing exists. Isn't that amazing? And also, perhaps, a little disturbing?


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2012/06/the-php-singularity.html

every server in the world with zero friction or configuration hassles

Actually I think this is very false. php.ini and compilation time configuration options can make your life hell with PHP.

great post, i agree with every single word of it.

I work with PHP every dayā€¦ and i must sayā€¦ it really sucks!
For my hobbies i learn and use python for programming what i like and projects in my spare time.
I change from php to python in a second!

Flask and even django is much better framework (for web programming) than the famous Zend Framework (urgh!).
And i find python initial configuration very easy to do!

Obvious that iā€™m trying to get out of the PHP world, but still is a battle iā€™m losingā€¦ perhaps in timeā€¦

ā€œIā€™m trying like hell to do my part to make it happen.ā€

Pardon my ignorance here, but what are you doing to make it happen? Which language are you pushing?

1 Like

make the alternatives so outstanding that the choice of the better hammer becomes obvious.

Uhā€¦ let me seeā€¦ Python? Ruby? C#? You can run Python and Ruby on plenty of places, Heroku being the easiest. C# can run with ASP.NET in plenty of places too, or web pages (PHP-like file-based structure) thanks to WebMatrix, onā€¦ well many too, AppHarbor being the easiest.

We have alternatives.

What could I do after building Stack Overflowā€¦ Stop the evil reign of PHP? Seems legit.

Somebody could compile a list of Perl5 modules which are useful for web programming and then create a meta module which depends on all of them

Then, installing would be as simple as cpan Web::Programming::All. Decent versions of Perl are installed by default in most Linux distros, so no need to install Perl itself

[ And in the future, when Perl6 is stable, do the same thing for Perl6 ]

1 Like

And thereā€™s only one thing worse in my eyes than PHP, and thatā€™s Wordpress PHP. Take all the awful things about the language (and none of the good stuff, even in PHP4) then smoosh it up along with your own horrid procedural concepts like ā€œthe loopā€, document only half of it, get hundreds of developers to add their tuppence-worth, then smugly tell the world you power 22% of the web.

Arrrgggghhhh. It could be so much better with a rewrite, but they donā€™t have the balls!

1 Like

What commenter Tadas says about deployment headaches is largely true in my experience as well.

That said, one thing to consider might be finding some way to leverage PHP as a deployment vehicle. Surely it should be possible to code up some sort of VM in PHP that executes three-address code, or to write a compiler codegen module that outputs valid PHP from its internal TAC representation.

So in the ideal world, you come up with this amazing new platform, call it JeffScript or whatever. You provide a great native tool chain and reasonable integration with the big players of web serving (Apache and IIS I guess) and then, as a ā€œside project,ā€ you provide an alternate deployment method that compiles to PHP (having coded up API bridges to the 25-30 most popular, but not part of the base package, PHP modules.) This approach has seen some success in things like Jython, Erjang, JRuby, etc. (Hell, thereā€™s apparently even a PHP -> Java bytecode compiler ā€“ who knew!?)

The problem I see here is that part of the attraction of PHP is that for beginners/prototypers/contract-developers, there are mountains of bad, but free and quasi-usable code out there just waiting to be (ab)used. Full CMSes! CRM applications! BBoard systems! Frankenstien-ing up hybrid web apps seems to be a major passtime of PHP contract developers, and itā€™s a feature that I struggle to see how JeffScript-on-PHP might leverage.

Just a thought.

One approach would be to try and play the same trick as Dart or CoffeeScript - write a language that compiles to PHP so that you can deploy it currently, but with a view to replacing it with a more stable platform which takes advantage of your new language. Itā€™d be very tricky to execute, but if it worked it could accelerate the move away from PHP.

Since you mentioned the fractal post, you should at least read my reply to it.

http://blog.ircmaxell.com/2012/04/php-sucks-but-i-like-it.html

I think you miss a very key point, that sucking matters for shit when youā€™re able to get stuff done with it.

Additionally, saying nothing has changed is a bit of a ruse. Follow the internals lists, and watch whatā€™s been happening in newer releases, and youā€™ll see that lots has been changing.

Overall, just another FUD article. Sighā€¦

I wonder if developing an Open Source blog engine to rival Wordpress in another language would help its decline?

While I agree that PHP has a disorganized set of public functions - the basic class system is quite sane from PHP 5 onwards.

I have to agree with Anthony Ferrara on this one.

PHP is the easiest language to set up with a (*nix) web server. That alone adds a lot of value. In comparison, setting up Ruby or Python is rather scary.

PHP isnā€™t the problem, bad programmers are the problem.

Besides, have you looked at makefile syntax?

1 Like

I think Anthony Ferrara hit the nail on the head.

The PHP community is practical above all else. What RoR does by developing an entire stack of functionality, PHP does with a few bash scripts, and then gets back to solving problems.

PHP sucks, C++ sucks, Javascript sucks, Java sucks, see a pattern?

I think the blog post entitled ā€˜The Silent Majority of Expertsā€™ describes this blog post very well

http://prog21.dadgum.com/143.html

JavaScript sucks pretty hard too, it exhibits some truly terrible design choices, but itā€™s immensely popular and there are no signs of itā€™s decline. Thereā€™s been a trend in recent years to put emphasis on the importance of writing good JS, and avoiding the bad parts (bad parts as famously highlight by Douglas Crockford), and JS has benefited immensely from this - thereā€™s been an explosion in the depth, variety and of JS frameworks/libraries etc.

Perhaps someone should, as Mr. Crockford did, start highlighting whatā€™s good and whatā€™s bad (in the practical sense, instead of complaining) and start educating people on these things, so that those that care about code quality can get on with writing PHP, and writing it well.

1 Like

I have a long relationship with PHP. Iā€™ve always thought it to be terrible (well, at least since the time I started high school), but I totally agree with you that it is near impossible to pick other choices.

PHP is supported on all shared web hosting servers. It is as easy as uploading your file and you are good to go. No strange CLI commands to run, no dependencies to download. Simple web form applications are really easy to get up and running in PHP (not as easy to make secure due to the non-existant type system). You donā€™t even need to know PHP to use it, you can learn as you go. Itā€™s very easy to pick up and you can see all your changes immediately.

These are all compelling features of PHP. In comparison, how do you deploy a Python web script? I mean a simple one-or-two-files type of script. Do you use the Python CGI module? How easy is it to read the querystring and posted form data in Python? How well documented is this use-case? If I search for how to publish Python to the web I end up with a lot of Django, regardless of if I really need a full-featured MVC framework.

PHP is easy to deploy in a hackish manner. It only sucks when you are trying to leave the ā€œhackish stateā€ or write something secure. I therefore think that the ā€œhackish stateā€ is what needs to be implemented in other languages. It must be easy to set up a simple script hack, but equally easy to deploy high-quality products.

Here are some of the features I think needs to be fixed by the PHP successor:

  • It must be easy to host. Shared web hosting companies must be able to do a simple ā€œaptitude install perfect-language-web-packageā€ or something similar and just tweak the configuration to their needs. The web hosting market is also heavily concerned with price so a free environment is preferred. This also sort of implies that there should be one preferred way of deployment, not a multitude of different methods.

  • It must be easy to deploy. It is hard enough to get web developers to grasp all the intricacies of FTP and user permissions. To get into the market you should be able to deploy by just uploading your files.

  • It must be well documented for web use cases. This includes tutorials, support forums and so on.

  • The language must have web support. It must have good support for web technology like HTTP headers, character encodings, file uploads, form posts, sessions, databases and cookies. Preferrably even a really good Ajax framework. Bonus points if most of this is automatic.

I welcome a future without PHP and I am prepared to help out on this work. Please keep us updated!

Not arguing for PHP here, but it has at least four things going for it that other mainstream languages donā€™t: low effort config, ubiquity, utility, and a short learning curve.

The newbie adoption experience for other mainstream languages and frameworks has a lot of friction.

And over time, the tools become more complex making newbie adoption that much harder (Iā€™m looking at you rails).

There are some efforts at helping with this (e.g. Yehuda Katzā€™s promising Tokaido).

But thatā€™s the exception, and it seems to me that the real solution to taking down PHP is providing an easier on-ramp for novices.

@Anthony Ferrara

ā€œI think you miss a very key point, that sucking matters for shit when youā€™re able to get stuff done with it.ā€

Well said and to be honest the only people who should give a shit are the people writing software, there is no perfect language that everyone loves and at the end of the day itā€™s our customers and users that should be the focus.

Programming language debates are about as relevant and useful as games console wars, use what you know and what you like, and deliver what the users want, because pretty much anything can be achieved in any language.

I dislike PHP, but do I care? Does it affect me? No, not at all, and thatā€™s the way it should be IMO.

I disagree about the frictionless everywhere comment. This may be true for apps written with only the core of PHP but start to get into the extensions and you can get all kinds of incompatibility problems.

God help you if you need to run Pear modules.

I once spent two days with a rock star sysadmin getting the ecommerce engine Magento to install right on CentOS. I think we even had to edit a make file at one point.