PHP At 20: From Pet Project To Powerhouse
snydeq writes: Ben Ramsey provides a look at the rise of PHP, the one-time 'silly little project' that has transformed into a Web powerhouse, thanks to flexibility, pragmatism, and a vibrant community of Web devs. "Those early days speak volumes about PHP's impact on Web development. Back then, our options were limited when it came to server-side processing for Web apps. PHP stepped in to fill our need for a tool that would enable us to do dynamic things on the Web. That practical flexibility captured our imaginations, and PHP has since grown up with the Web. Now powering more than 80 percent of the Web, PHP has matured into a scripting language that is especially suited to solve the Web problem. Its unique pedigree tells a story of pragmatism over theory and problem solving over purity."
Go on, we know you want to.
The great thing about PHP is that it's the one language that native, Java, .NET, python and ruby guys can all make fun of together.
Here's to another 20 years (or maybe 19, depends)!
Mod me down, my New Earth Global Warmingist friends!
There was plenty for the early days. Maybe they weren't newbie friendly due to having to actually learn programming before coding.
Sigh, ok, you insisted: https://www.youtube.com/watch?v=dQw4w9WgXcQ
This almost makes me wish Dice would go back to starting its flame-wars with stories on gender inequality.
PHP is the best!
im sorry you dont like the most popular language on the web you little fucking hipster, cry us a river
Hello world in PHP:
No Bullshit Boilerplate (TM), no needing 5KLoC of code and configuration, no application server to babysit 24/7, no need for catalina+tomcat+jakarta+jre+struts+hibernate+Xmxwtfbbq16GB, just load one module and every single customer sharing the server can use it... No need to understand the CGI protocol, no need to understand the HTTP protocol, no need to understand HTML even.
... blames his tools. Crap code an be written in any language. Good code can be written in PHP. While not my first choice of languages, I have found myself on PHP projects and been fairly comfortable using it although during moments of frustration put in comments such as "These following 10 lines could be written in the following one line of Perl...".
In a band? Use WheresTheGig for free.
Obligatory complaint about PHP's namespace implementation.
It's definitely a house, but I'd disagree about the power part.
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
PHP is Turing complete, so it's technically possible to write anything in PHP that you could write in another language. That seems to be about the most it's got going for it. PHP does nothing to help programmers write sane, maintainable code. It's almost impossible to develop without having a browser tab open to php.net ("The online docs are great!" "Well, they'd have to be."). There is zero consistency with things like argument order. Dangerous legacy concepts like "mysql_real_escape_string" are only recently deprecated and don't have a set removal schedule. It's a one-trick pony that's nearly useless outside its niche as a web page generation language. It's just a mess - a dangerous, unmaintainable mess.
I won't refuse to use an app just because it's written in PHP, but I do heavily weight it when comparing alternatives. PHP is a powerhouse in much the same way as McDonald's. It may be ubiquitous, but it still sucks and you have to question the judgement of anyone who chooses it to start a new project.
Dewey, what part of this looks like authorities should be involved?
The annoying thing is how many sites have so many security vulns due to copy+paste code or poorly written code. It took to long for the language to provide security features and it still lacks it as a default out-of-the-box enforcement.
Not as bad as perl or bash CGI (shutter), but it could have been better.
after being more than pretty good at C++/Windows/MFC coding for years, I ended up writing websites in java/struts. after a few years of that, quite frankly, I didnt want to program again.
along came PHP, must been a version 4 offering when i first looked at it. Freedom! no poxy try/catch around converting your text into numbers and other stuff. yes had some basic object stuff - good enough to work with If you could do good design and didnt do anything mental. I enjoyed coding again, once you had your framework up and going things could be remarkably quick.
the last project i started was a cakephp 2 project about 5 years ago and my job these days has coding only for internal jobs at the uni I work at. over 5 years i've added features and its a pretty good system, works well for what we need and dare I say better than any commerical offering we've seen (bit of a specialist area though) but its getting a bit old, lots of code is a bit of a hotch-potch as parts were hastily written and I dont get enough time to add all the new features we want plus refactor everything (the goal is to open source it - but not like this!)
so over the last 18 months i've looked at it and just want to make a rest/SPA version rewritten from the ground up. however I look at the PHP landscape now and cannot get any enthusiam. why take a nice simple language and try and turn it into a complicated mess like java? If you want to write like java and have all the features of java, go and write fucking java.
most of the additions I've seen don't fix anything I would say is fundamentally wrong. Closures? fuck off. likewise Generators. Namespaces? we're writing web apps here, pick a framework and add your stuff to it. you shouldnt be doing any complicated work that might require super specialised computing packages who names might clash. namespace/class autoloading is abused in frameworks so things look nice and neat, so even in frameworks you see people just relying on PSR autoloading code even though you are a fucking web app and you should just require() all the utility classes you are going to use (usual suspects like router, dispatcher, request object, response object,session etc) rather than taking the overhead of autoload. style over substance.
and FFS what is this fucking obsession with Dependency Injection? you look at frameworks and they list this as like a top 5 feature. who the fuck cares? there's ways round it even if you don't have it.
and composer - great pick a framework and find 20 libraries you've never heard of and don't undertand with various states of awful documentation slurped into your project.
Ahead of all that I would like to see is a shorter object notation and/or named parameters. you can keep all that other shit, I would just like to not have to type things like [ 'type'=>'input', 'name'=>'annoying' ] its just annoying keyboard-foo. get rid of quotes when you dont need them and just use a colon or equals eg [ type:input, label:"my label", value:$value] yes you might say but that clashes with definitions - well I've never seen a definition that didn't use ALL_CAPS to show to the world its a definition, just use that.. or use a different array definiton symbols like [[ ... ]]
so I just feel it is a bloated mess now and not fixing things that would actually be useful.
Now that MS is putting dot net everywhere, we are going to jump ship for C# and ASP Web API to create a SPA. With a lightweight JS top end, maybe even HP's Grommett? (again the proliferation of OTT JS frameworks is something for another topic).
Yes C# may be a full fat language, but at least its been designed from the ground up, not had bits nailed on. If I'm going to be forced by frameworks to do stuff like 'proper' languages then we may as well use a proper language.
I used the original, or close to it.
In 1995, I worked for a company in San Diego (MediaShare) that did Tesco's first online store.
MediaShare had a publishing tool called ProductBase, that put product details in a database, and you could publish to print or CD-ROM (remember those?). I proposed to my boss that we could also easily publish to HTML, and he let me explore it.
This turned ProductBase into basically a static-site generator, and Mediashare built some sites for some of their existing clients ("the threes" - 3COM and 3M - we put the 3M Adhesives catalog and 3Com's catalog of network products online for the first time) and some new ones.
One of the new ones was Tesco, and I built a little shopping cart with a very-close-to-1.0 PHP script running under Netscape Server CGI.
I would have never thought that PHP would still be kicking around this many years later. That was the last time I ever used PHP.
The author had no pretensions about PHP. It was a simple little script to help him with his personal home page, and he admitted his lack of programming expertise. Others turned it into a Frankenstein's monster.
Just like good Perl is possible. That being said, if you are going to take the time to write correct, well-architected, maintainable, etc. system, you will spend equal amounts of time in any language or framework. PHP makes some things very easy, but that easiness is skin-deep, and it's exactly the same with Ruby on Rails. Yeah, you can rapidly prototype things and get stuff running in front of people. Scaling it, making it robust, and making it part of a whole ecosystem of mutually self-supporting tools, applications, and utilities? You know... real world software needs? That's going to take a good amount of effort and design in any mature framework.
From shit to heaps of shit.
By amateurs, for amateurs.
Anyone using PHP is a non-programmer by definition.
And anyone shouting 'noob' is a non-thinker.
PHP does not power 80% of the web, it is merely present on at least one server behind 80% of TLDs. That's not the same thing.
You misspelled "Whorehouse" guys...
Populus vult decipi, ergo decipiatur...
"Force shits upon Reason's back." - Poor Richard's Almanac
Says the nonprogrammer. Hushify kid.
Who shouted 'noob'? Other than you, of course.
Cue the snobs who look down on others based on a programming language.
PHP is the shitiest language out there except for all of the others.
So what? If you don't like it, don't use it.
How would one go about writing an extension for an existing large codebase, such as phpBB, MediaWiki, or WordPress, in a language other than PHP? And it's likely that some of these codebases began years ago when shared web hosts charged extra for languages other than PHP.
Please define "programmer" for us.
BeauHD. Worst editor since kdawson.
I can't say I love it, but it's usually available, and it usually works. What's the problem?
The == operator is broken
The same is true of JavaScript, which is why Douglas Crockford in JavaScript: The Good Parts recommends always using ===. PHP developers would be wise to read that to see what warts PHP shares with some other popular languages.
Anyone using PHP is a non-programmer by definition.
I'm a professional software engineer working on OS-level software for a heavyweight in the tech industry. I also use php in a non-work context. And I actually enjoy it
Guess you'll have to peddle your absolutisms elsewhere.
People who say "sheeple" have about as much sophistication as an AOL user, and in fact are probably actually AOL users.
"Someone who writes PHP and LIKES IT."
As in https://speakerdeck.com/nineties/creating-a-language-using-only-assembly-language
PHP doesn't dominate; it's attached to WordPress. That's it. If WordPress had chosen any other language....
PHP devs often take a lot of shit from Java, Ruby, etc developers. Because it is so easy to write code in PHP, it tends to attract people with poor programming skills. However, you could write anything just as good in PHP than you could in any other language. For instance, I think it is easier to write more professional code in PHP than it is in JavaScript, even though I like JS at the moment.
I discovered PHP a decade ago when I needed to implement a very simple LAMP server for a small group of scientists. First, as a C programmer, the syntax was easy (love those semicolons, but what's with those $$$?). Second, it has every kitchen sink function included, When I needed the Levenshtein distance, it was there - levenshtein().
It all depends what you want and need. In the last ~10 years I've built numerous sites with PHP and although the language has its flaws, I love it.
PHP has made me hundreds of thousands of dollars over the years without costing me a cent. (I use a classic LAMP stack w/ mysql for the DB). Pretty much whatever I need, PHP can do it. It's enabled me to make a good living through my own work and creativity, and it hasn't cost me a dime.
Yes, PHP has warts. No doubt about it.
Yes, it has some (lots) of inconsistent function-naming. It's annoying but, eh, not a deal-breaker.
Yes, some functions are weird, like implode(), which can take arguments in any order. I mean, WTF?
Yes, there are some abstract features in the OO-gobledygook that aren't there or don't frambulate properly or whatever, and I don't care one bit because I don't code any Obect Oriented bullshit.*
Yes, a lot of the things "PHP-detractors" say are absolutely 100% true. I won't argue, much of what they say is valid.
And you know what? I don't care. :)
PHP works for me, and I wouldn't make one extra nickel by switching to another language- any language. PHP does what I need and does it well. It's made me a boatload of money and that's the bottom line when it comes to feeding my family.
So yes, PHP is a terrible language and I love it!
*"OMG, you don't code in OO? How do you sleep at night?"
Answer: "On a big pile of money made by coding stuff functionally/programatically in PHP"
Yes, there are some weird/frustrating/awful things about PHP, but I love it- it's made me a ton of money as an independent site owner/operator and hasn't cost me anything.
Just cruising through this digital world at 33 1/3 rpm...
Gee, then I must not exist. I've been making a good living writing PHP for over a decade, perhaps you can tell me what I've actually been doing all this time?
Just cruising through this digital world at 33 1/3 rpm...
Sure
If true, you are in the 0.00001% and why are you using such a poorly designed language when there are many better options and no options that are worse?
PHP was written by retards for retards.
reddit.com/r/lolphp is the only lol* board that has new idiocy each week.
Here are some quotes from the head retard Rasmus:
I really don't like programming. I built this tool to program less so that I could just reuse code.
I was really, really bad at writing parsers. I still am really bad at writing parsers. 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.
There are people who actually like programming. I don't understand why they like programming.
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.
He personifies PHP and that is the reason everyone with a clue laughs at PHP
Actually, you're mistaken. I understand exactly what I need to do to get the results I want, and doing it in PHP earned me a nice living. Using PHP (the LAMP stack, really) has allowed me to work for myself, create businesses, earn money, and live pretty well. I have a hard time understanding what you don't like about that, unless it's based in jealousy. If you don't like PHP, don't use it. You're welcome to use whatever programming language you like without fear of me telling you why you're "wrong".
Just cruising through this digital world at 33 1/3 rpm...
Yep, PHP makes things simple, and there's an excellent selection of modules that can be loaded for more unusual requirements. When I saw all the junk that was required to use a typical RoR app, I laughed and closed the page.
Just cruising through this digital world at 33 1/3 rpm...
Equality is not transitive in PHP (null equality is not consistent)
True, PHP == is brain damaged. But is there a case where ($a === $b) && ($b === $c) && ($a !== $c)?
Yep. I won't touch PHP. Ever. Any time I run across something I want to run and it says "requires PHP", I skip it. Even if there are no alternative programs/applications/projects.
You use this decision making process for everything? i.e. If you don't like something you simply won't use it even if there are no alternatives? Interesting attitude.
"lt;dr" is the correct response to most of my posts.
The proper language depends on the job. Writing native OS code? Use C/C++. Writing Web pages? Use LAMP stack. Writing a server side data service? ...choose your own adventure already.
I actually shifted from ASP.net to PHP and I've never looked back.
troll
You are an untrained monkey pounding on your keyboard until it sort of works, although you don't know why it does.
And you're an anonymous coward with nothing meaningful to say.
People who say "sheeple" have about as much sophistication as an AOL user, and in fact are probably actually AOL users.
...now it has matured into a big silly project? How is that news?
Why garbage? Here's why:
1. Standards change all the time. What's the default value for that global? Depends upon the version. What? That global didn't exist when you wrote your code, so you can't check its current value to see if it affects you? Go fuck yourself.
No one cares. Nobody uses global anything since 4.x.
2. Libraries and APIs are added, replaces, and sundowned at will. Want to do an http redirect in the current version? Go fuck yourself!
No one cares. I can find all changes with 20 seconds on php.net, one of the best PL documentations every. The differences and deprecations and changes are listed per version. And they're a good laugh during a boring coding and debugging day. Especially those parameters and function names. :-)
3. Error handling. Look it up. Or, rather, the designers need to do that and then implement something sane, and do it consistently.
Yeah, right. Like you - or anybody else - uses error handling consitently, no matter the PL. *I* only use it when I don't know what to expect from the adjacent API. And then I usually leave the catch loop empty, except for some printed output or something.
We suffer more in our imagination than in reality. - Seneca
Integers that overflow and become floats. Gimme more of those...
I've been working for more than 9 years with PHP and pretty much have seen it all. From cheap quality boilerplate code hell, to really well designed code.
The main problem with PHP is that it's lack of features sometimes forced you into using bad practices. See for example the lack of namespaces/packages way over the time every other language had an implementation for that. This is solved for now, but there is a lot of legacy code that is still out there and making other programmers pull their hair.
Nowadays PHP has evolved, and frameworks have started using the new features in an elegant and powerful way. Some of the criticisms to PHP are still valid, other don't apply anymore. I for one think that PHP has get enough good features to ditch the "you're bound to write shitty code if you use PHP" motto. There are better languages, yes! I use them and I like them, but that's not a good reason for believing that using x language makes you a shitty developer and using y language makes you a good developer. Still... some languages might make it harder to write good code, and that's why you have to be wary and consider options.
I don't love PHP, I won't marry PHP (that's why I'm currently learning other languages to expand my career or simply having fun) but I wouldn't marry any other language either. I love programming and I see each language as a tool which might or not be useful, I'll keep learning, but I won't trash what I know because bashing it becomes trending topic among IT freshman.
Just because you don't comprehend the usefulness of PHP doesn't make your whining about how 'inferior' it is valid. Like all tools, it has its place. I've been building web applications with PHP for about 15 years now. It just gets shit done. Any coder worth his salt can build an application that is every bit as maintainable and secure as any other language. Maintainable != compatible with the latest bleeding-edge version of PHP. Yes, there are trade-offs in choosing PHP over another given language - but that door swings both ways. PHP may very well be inappropriate for your application - but that doesn't mean it's inferior.
Someone trained enough to know PHP is shit.
+100000 All the butt hurt PHP losers hate it when you point out that they are untrained.
Cue the untrained PHP fanboys who think that proper CS is "snobbery".
PHP is a blight on my craft and is argument #1 why programmers need to be certified like public engineers.
Filling up a TB hard drive with PHP code on a machine with less than 1GB of RAM and it will all still work. This makes PHP hosting dirt cheap and is the primary reason why it excels at simple "render this stuff from my database" type applications without having to boot and preload every piece of code in RAM even when it's not being requested.
This is why it's great for Wordpress, blogs, CMS, marketing sites, simple forms, etc.
It's bad for long running process and complex multi class web "apps". It definitely has it's place but it's not right for everything.
Not being the best choice for everything does not make it crap though. Just means that it's not good for what you want.
Are you stupid or something?
./configure
Oh wait, you are an uneducated PHP monkey, of course you are stupid.
Try installing PHP from scratch and come back here with your bullshit. It is only easy because all the work was done for you. If you want to setup PHP where it is only 90% insecure instead of 100%, add about 6 days of work.
PHP is not easy for a beginner because it is insecure by default and tons of errors get ignored. It is not easy for a professional because it is so damn hard to not fuck something up. PHP is the only language that makes doing the wrong thing easy and encouraged and doing the right thing difficult.
Ask any Facebook programmer what they think of PHP. They will all say it is utter dogshit.
As for Ruby it is trivially easy to set up and set up in a correct and secure manner.
I can go from blank VM with only the base OS installed to a fully installed and configured Rails app in 20 minutes, without anything but bash.
wget ruby_url/
tar -zxf ruby.version.tar.gz
cd ruby
make && make install
gem update --system
gem install bundler
gem install passenger
passenger-install-nginx-module
cd to location of rails app
hg clone rails_app
cd rails_app
bundle install
rake db:migrate
rake db:seed #if db needs some default entries
rake assets:precompile
#paste in a few lines in nginx.conf
start nginx
That is 20 minutes in a slow instance. That all can be easily scripted
To update the rails app
hg pull
hg update
#precompile assets and run bundler if needed
passenger-config restart-app
or you can automate that will capistrano which makes it cap deploy It is even easier on Heroku.
Fucking PHP cretins need to die in a fire and stop making the internet such a dangerous place.
You losers are a blight on my craft. Programming is a professional endeavor. If you aren't intelligent enough to get properly educated, get the fuck out.
Only PHP retards would read PHP for fucking numbskills, copy/paste some insecure code and call themselves professionals.
You jackasses are the reason we need a professional society with a required certification needed to produce public-facing code. Like real engineers.
You could spend 10 times the effort on PHP than in Ruby and you will still get shitty PHP because PHP the language and API is utter dogshit.
when shared web hosts charged extra for languages other than PHP.
They did that? Why?
I assume it must have had something to do with PHP's "safe mode", which enforced additional application-level sandboxing on top of what the UNIX permission model already enforced, restricting access to exec and to even world-readable files owned by another user. PHP has since abandoned safe mode but still retains open_basedir, which doesn't let a user open files outside a whitelist of directories. Other languages tend not to ship with analogous measures. Python, for instance, tried Bastion but abandoned it.
OK, so you don't know what a programmer is. Got it.
BeauHD. Worst editor since kdawson.