Slashdot Mirror


PHP Next Generation

An anonymous reader writes "The PHP Group has put up a post about the future of PHP. They say, 'Over the last year, some research into the possibility of introducing JIT compilation capabilities to PHP has been conducted. During this research, the realization was made that in order to achieve optimal performance from PHP, some internal API's should be changed. This necessitated the birth of the phpng branch, initially authored by Dmitry Stogov, Xinchen Hui, and Nikita Popov. This branch does not include JIT capabilities, but rather seeks to solve those problems that prohibit the current, and any future implementation of a JIT capable executor achieving optimal performance by improving memory usage and cleaning up some core API's. By making these improvements, the phpng branch gives us a considerable performance gain in real world applications, for example a 20% increase in throughput for Wordpress. The door may well now be open for a JIT capable compiler that can perform as we expect, but it's necessary to say that these changes stand strong on their own, without requiring a JIT capable compiler in the future to validate them.'"

26 of 213 comments (clear)

  1. Re:I got tired of waiting by philip.paradis · · Score: 5, Interesting

    I've mostly just stuck with Perl and Bash, and I'm still not sorry.

    --
    Write failed: Broken pipe
  2. If PHP was a horse in the prog language race by Anonymous Coward · · Score: 4, Funny

    It should have been shot in the paddock.

    Mind you at the other end of the spectrum we have the entry from academia "Haskell" that has already completed the course and is back in the stables. Unfortunately they haven't found a way to get it to interact with reality yet as that's an implementation issue.

    Feel free to add an analogy to your language pet hate below.

    1. Re:If PHP was a horse in the prog language race by smittyoneeach · · Score: 5, Funny

      Now, in defense of PHP, I've been trying to compile Yesod, so that I can take it out for a spin. I update cabal, tell it to install, get enough compilation pages scrolling by to make GCC envious, and. . .it crashes.
      PHP at least lets me set up a web site and get hacked.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    2. Re:If PHP was a horse in the prog language race by narcc · · Score: 4, Insightful

      Still waiting for at least a half-decent argument that it "sucks". (I've seen the fractal article, and then I fact-checked it. Guess what I think about it now?) It seems uniquely well suited to its niche, and more than capable. More than 80% of websites seem to agree. You don't get that kind of market penetration by being "virtually unusable" like the Slashdot hive-mind seems to believe.

      Who knows, maybe it does "suck" -- it just happens to suck significantly less than all the alternatives.

    3. Re:If PHP was a horse in the prog language race by Anonymous Coward · · Score: 2, Informative

      I've seen the fractal article, and then I fact-checked it

      Did you fact check it using PHP?

    4. Re:If PHP was a horse in the prog language race by El_Muerte_TDS · · Score: 2
    5. Re:If PHP was a horse in the prog language race by Ash+Vince · · Score: 4, Interesting

      I've seen the fractal article, and then I fact-checked it

      Did you fact check it using PHP?

      I am not sure what that second bit of PHP sadness it really moaning about to be honest.

      Ok, I understand the difference, but I also think that anyone who wrote code where the stacked ternary operators like that should be sacked. There are times when the ternary operator is useful, but it has to be used carefully if you want to keep your code easily readable by other people, stacking them like that is a quick recipe for unmaintainable junk useful for nothing else than building your own empire.

      Also, wouldn't a few well placed brackets both solve the problem and make the code more readable?

      --
      I dont read /. to RTFA, I read /. to offend people in ignorance.
    6. Re:If PHP was a horse in the prog language race by drinkypoo · · Score: 2

      See, back when mod_perl was a newer thing, we were having the same discussions about it. PHP just keeps working. People can (and do) bitch about its shortcomings, but it still works.

      I am not a programmer by any stretch and even I have shaken my head at the way PHP does this or that over time, but that doesn't change its utility. It's very like perl in that regard, except it's actually useful for web development because it can be installed and web hosts provide it.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    7. Re:If PHP was a horse in the prog language race by Xest · · Score: 4, Insightful

      The problem with everything you say, every comment you make on PHP and Javascript is that it goes along the lines of:

      "Still waiting for at least a half-decent argument that it "sucks". (I've seen the fractal article, and then I fact-checked it. Guess what I think about it now?)"

      Please elaborate. Tell us what you found not to be true in that article, tell us what your fact checking discovered. Don't just say "I fact-checked it" and then that obviously means it wrong. Guess what you think about it now? I've no idea given that you've never ever managed to counter it at all, are you perhaps thinking "Fuck it's right, but I can't rebut it, so I'll just pretend it's wrong"? Did I guess right?

      "More than 80% of websites seem to agree."

      Where is the evidence? Even if true what proportion of major players use PHP? Very few serious players who have to maximise stability, performance and security do - Twitter? Nope, Google? Nope, eBay? Nope, Amazon? Nope, Slashdot? Nope, BBC? Nope, Microsoft's sites? Nope, Apple? Nope, YouTube? Nope, Blogger? Nope, LinkeIn? Nope. Facebook goes near it but even they've been translating it to C++, or trying to convert it into Java with a JIT for the last 5 years. Other than that there's what, Wikipedia and Yahoo? Fact is in major sites even Python has more of a showing than PHP. Even if PHP is used in more sites, it's used in less serious sites that actually matter so sure PHP may be prolific in first time or throw away sites, but if you're doing anything as a business, if you're doing anything where you want security, stability, and performance, then PHP is not a viable option. You don't find PHP in banking or most of the major eCommerce sites for example, it's Java for the most part.

      Look, I'm not saying you're wrong about PHP, but you're infuriating to have this discussion with because no matter how hard I or anyone else tries you just never back up your claims. You just make comments like "There's nothing wrong with PHP", "The fractal article is nearly all wrong", but you can never prove it, you can never elaborate, you can never expand on it. I can't tell if you're a shill or a troll, I find it hard to believe you're anything else for the simple fact that you're so utterly evasive in justifying your arguments.

      The "PHP is a fractal of bad design" article is a long well argued piece on PHP. If you want to have it declared wrong you similarly need to take at least some time to tear it apart. Simply saying something is wrong doesn't make it so, you have to explain why and how it is wrong.

      Until you can start backing up your claims, one can only assume you're simply full of shit - a troll, a shill, a fanboy, whatever. You need to start justifying your claims - those criticising PHP have done so time and time again, and many just point to fractal precisely because it saves them having to repeat those already well established points. I've yet to see anything that can counter it, the best I attempt I saw was this forum rebuttal:

      http://forums.devshed.com/php-...

      The problem is, the author of it only manages to demonstrate how little he knows about software and programming, rather than demonstrating that article he's disputing is wrong in many, or even any ways. I would love to have my knowledge expanded by being informed as to the many ways in which fractal is wrong but all those of you that claim to have this knowledge seem unwilling to provide it, is there some curse on it? will the world end if you tell us why fractal is wrong or something?

      Long story short, less fanboy, more facts please, and if you're not willing to start arguing your case with facts then stfu because I'm sick of seeing PHP articles flooded with unsubstantiated fanboy nonsense. You're like the annoying religious guy who argues that god exists just because he does and that's all there is to it, you can't justify the claim, you can't explain why, but you've decided in your head he's real without any justification so that's it he absolutely must be.

  3. Re:What about PHP on the JVM? by Anonymous Coward · · Score: 2, Funny

    Yes, that's just what the world needs: the rigorous code quality of PHP combined with the high performance and lightweight Java Virtual Machine.

    Any chance you could throw some Haskell and M4 macros in there, too?

  4. I'd rather code COBOL or FORTRAN by msobkow · · Score: 3, Insightful

    I've had the misery of suffering with maintaining a few PHP applications over the years. It is, bar none, THE WORST LANGUAGE I have ever used. Even COBOL does a better job of handling the humungous amount of copy-paste code that PHP requires. Even FORTRAN does a better job of error checking before run-time.

    Sure, it's popular.

    So is McDonald's.

    That doesn't mean it's good or good for you.

    --
    I do not fail; I succeed at finding out what does not work.
    1. Re:I'd rather code COBOL or FORTRAN by Anonymous Coward · · Score: 5, Funny

      PHP is great when you need to deliver a working prototype yesterday and someone else will have to maintain the code.

    2. Re:I'd rather code COBOL or FORTRAN by Anonymous Coward · · Score: 2, Insightful

      I think that a lot of the criticism PHP gets is undeserved.
      If used correctly, PHP can be a very clean language. If you use the object-oriented facilities, it is as capable and clean as any other high-level language.

      The biggest problem with PHP is that it's also a very forgiving language, as in, it pretty much allows a novice programmer to get results quickly and easily with horrible, unmaintainable code.
      This is a double-edged sword, and since most programmers never evolve past novice status, it has polluted the well and resulted in PHP's crappy reputation.

      On the other hand, that very friendliness is what made PHP so popular, but that in itself is a good thing: nowadays if you develop your application in PHP, you're pretty much guaranteed to be able to host it from any server you can think of.
      But as I said, PHP applications can be done well, you just have to be aware of your coding practices and enforce them on your team.

    3. Re:I'd rather code COBOL or FORTRAN by caseih · · Score: 3, Insightful

      Yes I have used Python, actually. and I've found the same thing ESR discovered about it years ago. Python promotes rapid development with fewer errors than many other languages. And it's generally clean and extremely easy to read. Python has its warts of course. And gotchas. PHP has its good points and bad points as well. But to try to disparage Python just to make your point that PHP is great is pretty silly. If PHP is great it should stand on its own regardless of your personal language preferences. And I think it can. That's not to say, of course, that PHP does not have many problems as a language; it does.

    4. Re:I'd rather code COBOL or FORTRAN by JaredOfEuropa · · Score: 5, Insightful

      PHP is great for prototyping, throwaway scripts, or other quick & dirty stuff. But if any of that kind of code makes it into a critical production environment and turns it into a maintenance nightmare, blame the manager who allowed or ordered that, not the language.

      PHP can be used for production stuff as well, if you're careful. I was involved in building a mission critical system for a large corporation, and we selected PHP since the client already had a sizable pool of experienced PHP developers. We built the system relatively quickly and had little trouble handing it over to the team handling maintenance and enhancements, and it's been running happily ever since. What helped was applying good common coding sense, such as extensive error handling, and comprehensive unit testing against the documented functionality of each module / function. I've used far worse languages...

      --
      If construction was anything like programming, an incorrectly fitted lock would bring down the entire building...
  5. Re:I got tired of waiting by narcc · · Score: 4, Insightful

    From inconsistent to consistent

    You're talking about Python, right? It may be a lot of things, but consistent isn't one of them.

    From difficult to scale to easy to scale.

    Again, Python? Also, I wasn't aware that PHP was "difficult to scale". No one else seems to have trouble with it. Well, "double-digit percentage of total internet traffic" sites excepted, of course. Though at that point, just about everything is "difficult to scale".

    From crappy web frameworks to excellent web frameworks

    I've never seen a "web framework" I'd classify as "good", let alone "excellent".

    I'm still floored by the Python recommendation. This is a language that couldn't even get a simple print function right until version 3. A language so fundamentally flawed that the syntax can't adequately handle its features (anonymous functions, for example). A language known for abysmal performance. A language that can't even maintain compatibility between minor versions.

    You want people to invest in that? That's just crazy.

  6. Re:What about PHP on the JVM? by baldass_newbie · · Score: 5, Funny

    "Yes, that's just what the world needs: the rigorous code quality of PHP combined with the high performance and lightweight Java Virtual Machine."

    Fortunately, I had already swallowed my coffee so the keyboard was safe.
    However, your point is valid. Just because you can theoretically run something on something doesn't mean it's a good idea.
    Anyway, I need to get back to writing a JVM in VBA. This is going to be the tits.

    --
    The opposite of progress is congress
  7. This is why PHP continues to thrive by Qbertino · · Score: 4, Interesting

    Despite all hatred - and let's face it, PHP is a really strange phenomenon - this is why PHP continues to thrive. The PHP community gets from A to B by the most bizar reroutes across Z, Mary Poppins and f(x)=x^2e^x-2. PHP is a fractal of bad design, but they always seem to focus on the next issue that's simply in the way of getting the next real world job done. I've written a post on that a few weeks ago.

    Them checking the performance of Wordpress (one of the large popular CMSes out there, with a really shitty architecture ... like most of its kind) as a benchmark for the foundation of a VM show how 'fast result' oriented the PHP community is. The idea itself of testing like this would seem insane to any serious developer, AFAICT.

    Point in case for PHPs insanity that always seems to work out in a strange way:
    I've fought it for over 12 years, but now I've finally given in and am working myself into Typo3, a big-league player in the world of PHP Web CMSes. Let me tell you: If you think Wordpress, Drupal or Joomla have an architecture that was designed by chimpansees (I should now, I've deployed Drupal and Joomla professionally and was on the Joomla Bugsquad), Typo3s has one that was designed by amobeas. With TypoScript - the T3 template and config language - they've got the textbook example of an inner platform (think PHP but non-turing complete for configuration and with magic numbers ... sort of like line-numbers, but not quite ... its really crazy ...). If PHP is a fractal of bad design, Typo3 classic is that ^2. It's very difficult to describe, you have to experience it for yourself to fully understand. It's like taking the red and the blue pill at the same time. Seriously.

    Anyway, I'm veering off. The point is:
    Knowing Typo3 is basically job security galore for any web developer in Germany. Period. I've agreed to dive into T3 and am right now scoring more than 60Ã an hour. Being able to edit templates in the CMS Admin area isn't bad either. ... Although TypoScript is one of the strangest things I've seen in my 28 years of computing, I have to admit. Think of Typo3 as the Vi and Emacs of CMSes, all rolled into one. Yet there are over 2000 official Typo3 agencies here in Germany. Being an online agency basically means being a Typo3 agency over here. What do you say, it's what people want. T3 is a household brand, it has an official association, a neat website and the vibe of "big, complicated and professional" all over it. The customers want it, and they're willing to pay for deployment in T3. Who am I to complain?

    PHP is bad, and nobody cares. Its barrier of entry is basically non-existant, security issues be damned, and they have a slew of pointy-clicky stuff for the peddlers to sell to end-customers. All for free. The most succesful FOSS projects are written in it and if the PHP crew are going to stick to their crazy "make it work, then make it beautiful" approach, it's probably going to stay that way for a long time.

    My 2 cents.

    --
    We suffer more in our imagination than in reality. - Seneca
  8. Re:I got tired of waiting by Stellian · · Score: 5, Insightful

    JS on the server is clearly big contender for PHP: it's great for quick and dirty prototyping, awful for large projects, and significantly faster than PHP.

    JS is the perfect recipe for language lock-in that's even stronger than PHP: front end developers already "know" it, they write a botched version of the backend code that 10 years later turns into an incomprehensible behemoth; any attempt to rewrite it will be rejected for "performance" reasons.

  9. I confirm: The Beta UI is really shitty! by Qbertino · · Score: 2

    See the double post? You can thank beta for that. Mod this one down or turn it off if you are an editor, the one below is the final version.
    No more beta for me.

    --
    We suffer more in our imagination than in reality. - Seneca
  10. Re:Reinventing the wheel by itsdapead · · Score: 5, Informative

    Why not use Node.js that has already got the wheel (JIT) rather than drilling holes in PHP to fit an axle?

    Because PHP also has a perfectly good chassis, body, roof, steering wheel, gear shift, seats, windows, instruments, cup holders, audio, fluffy dice etc. that you know how to use and don't want to throw away.

    People don't use PHP for the language (which is fugly), they use it because it has a huge collection of useful libraries, supported and well documented on the php.net site - and it is almost certainly available on your web hosting service.

    Not knocking Node.js, but it is still "getting there" as far as mature library support goes: yes, there are plenty of modules, but you're still more likely to find 4 diverse, half-written modules for a particular function than one complete, well-documented, future-proof choice.

    It can also be overly complex: Node's USP is asynchronous, event-driven programming, which is cool, but harder and overkill for many applications. Then there's the small matter of having to effectively roll your own web server for even the simplest dynamic web page (OK, you'll probably use a third party module - pick one and hope it stands the test of time, then learn how to configure it) and you'll still probably need a black belt in Apache to set up a reverse proxy to your app.

    Mind you, the great thing about Node vs. PHP is that nobody ever has anything bad to say about Javascript as a programming language </sarcasm>

    --
    In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
  11. Re:What about PHP on the JVM? by binarylarry · · Score: 3, Interesting

    Doesn't seem like a bad idea. HotSpot will likely always be faster, more secure and more reliable than any VM the PHP devs cobble together.

    --
    Mod me down, my New Earth Global Warmingist friends!
  12. Re:I got tired of waiting by i_ate_god · · Score: 3, Insightful

    > You're talking about Python, right? It may be a lot of things, but consistent isn't one of them.

    Python's inconsistencies are bizarre enough that they become easy to remember, and there aren't that many. PHP's inconsistencies are much more subtle, and are everywhere. Peruse the string functions for a good example...

    > Again, Python? Also, I wasn't aware that PHP was "difficult to scale". No one else seems to have trouble with it. Well, "double-digit percentage of total internet traffic" sites excepted, of course. Though at that point, just about everything is "difficult to scale".

    for web apps I'd assume python and PHP have the exact same problems, and more or less the exact same solutions. PHP is going to be slower if you use mod_php over php-fpm though, which many don't do. As well, it's a lot easier to write up performance-dependent code in C when using python than when using PHP.

    > I've never seen a "web framework" I'd classify as "good", let alone "excellent".

    You should elaborate on this. Are these just frameworks for PHP and Python or are you being language agnostic with this statement? I've grown comfortable limiting my webapps to just RESTful APIs that frontends use and whipping up those APIs are painless in almost any language that has something similar to JAX-RS/Flask/etc

    > A language known for abysmal performance

    False, an implementation known for abysmal performance, which is CPython.

    --
    I'm god, but it's a bit of a drag really...
  13. Re:I got tired of waiting by Bengie · · Score: 3, Insightful

    All kinds of people have trouble with PHP, they just don't realize it. It lulls you into a false sense of security by not throwing errors or warnings with its ultra-lax dynamic typing. PHP is like silly-putty, you can quickly make any shape you want, but thinking you've built something that you understand it is just fooling yourself.

  14. Re:I got tired of waiting by digitalPhant0m · · Score: 2

    it's great for quick and dirty prototyping

    I've heard this for nearly every interpreted language. The only problem is: that quick and dirty prototype almost always winds up being the production codebase.

  15. Re:Only on paper by dgatwood · · Score: 2

    Personally, I blame the MySQL team for nightmares like phpBB and vBulletin. After all, mysql_query is still available in the language, despite being at fault for a staggering percentage of PHP application security flaws. The PHP folks have at least finally deprecated it in 5.5, and theoretically it will go away in the future, though at this point it is so ingrained that when they do, most folks will just reimplement it using a template-based query, but with no template fields, and we'll be in the same boat as we are now.

    In an ideal world, that function/method should never have existed in MySQL to begin with. But even if we accept that it was unavoidable, the function/method should have been removed from MySQL a decade ago, because even way back then, it was obvious how flawed an API it is. Had they done so, it wouldn't have continued to exist in the PHP bindings, because it wouldn't still have been in the library.

    The rest of the security problems with PHP are, as far as I can tell, pretty much comparable to any other language—improper quoting of content for use in various aspects of HTML output, cross-site scripting bugs, etc.

    BTW, if you want a PHP bulletin board that's more sane, check out JaxBoards, and grab my fork where I rewrote every single database call to use template-based queries. It's a fairly clean design that separates the presentation from the core to a significant degree, and whose database code is fairly straightforward. If you spot any security bugs that I haven't already fixed in my branch, let me know.

    --

    Check out my sci-fi/humor trilogy at PatriotsBooks.