PHP 5.6.0. Released

PHP 5.6.0., considered a very important cornerstone by many, has been released today. We’ve talked about the changes this version brings in previous posts, and others have written about it, too.

Recap

To recap quickly:

  1. MIME types in the CLI web server have been added
  2. Internal Operator Overloading
  3. Uploads of over 2GB are now accepted
  4. POST data memory usage decreased and ::/input is reusable
  5. Improved syntax for variadic functions, functions that can accept an arbitrary number of arguments
  6. Argument unpacking
  7. Constant Scalar Expressions
  8. PHPDBG bundled by default
  9. Zip improved
  10. Importing namespaced functions and constants
  11. Exponentiation ($a = 2**3;)
  12. Default UTF-8
  13. GMP operator overloading

Regarding BC breaks, some of them include:

  1. GMP resources are now objects, which will break previous usages of is_resource
  2. mcrypt requires valid keys and IVs
  3. json_decode is more strict about upper/lower case on “true”, “false” and “null”

You can go into detail by reading the previous posts we wrote on these topics, or by reading the migration guide: http://docs.php.net/manual/en/migration56.new-features.php

Updating

You might be wondering about update procedures – do you have to add new repos to your OS or compile from source to get them to work? What about VMs? Well, you can do that (see our old post on getting RC1 to run on Homestead, or coderabbi’s post about upgrading the current Homestead box to 5.6), but you don’t have to. Taylor Otwell has already promised to update the original Homestead box with 5.6, so you can continue to use our Homestead Improved as you always did – up and running in five minutes tops.

Like the man says, all you’ll need to do is run vagrant box update and your box will be refreshed with the latest version. This applies both to the original Homestead and my own Homestead Improved. It might take a while for Vagrant to redownload the box, but once done, everything should be as easy as it ever was.

Note: The box has since been updated, enjoy!

If you’d like to keep track of the original box to see when it updates, see here.

What now?

So what’s next? While the internals group is working on PHPNG and PHP7, whatever those may end up being called, take the time to get familiar with PHP 5.6. If you use shared hosting, ask them to upgrade. If they don’t have plans to do so, ditch them and show them you don’t support outdatedness. Get a cheap virtual server at DigitalOcean – heck, using this link will even get you $10 which lets you host a level two server for a whole month, or a level one server for two months. That’s plenty of time to see what they offer.

Use Heroku’s free tier to get 5.6 up and running, play around with it, explore. Step ahead of the curve by diving head first into the cutting edge and don’t let yourself be left behind by those ready to take the plunge. We’re stable, this is no longer beta or RC mode – it’s safe to upgrade, and it’ll only benefit your applications in the long run. If you’ve got some legacy code to maintain, ditch that too if it’s not compatible with 5.6.

Have you experimented with 5.6 features in a real world use case yet? Let us know in the comments below! Better yet – if you can put together advanced demos of these features, we’ll pay you for the right to publish them. Go forth, and multiply your projects!

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • CTN

    this latest version is for dev only, not for production, so I don’t think anyone would be ditching hosts.

    In any case, if you’re serious about developing, you would have a VPS or dedicated server and you can load whatever you like on the box. shared hosting is for end users.

    • http://tildehash.com/ TildeHash

      “this latest version is for dev only, not for production”

      Um, no.

      PHP 5.6.0 is a stable release, completely suitable for production use. Notice how there isn’t any “RC5″ on the end, therefore it’s considered a stable release, and indeed I’ve not encountered any bugs.

      • CTN

        LOL. seriously? it got released today and you think it’s ready for production servers?

        no serious project will run on a new release anything until it’s been thoroughly tested.

        and no, your wordpress blog is not a serious project.

        • http://www.bitfalls.com/ Bruno Skvorc

          It *has* been tested, that’s what the month of RC mode and all those betas were for.

          • CTN

            I knew someone was going to say this. I was just waiting for it.

            All the release candidates in the world and betas still don’t equate to the final released version.

            5.6 will still only be used for dev servers and testing purposes for weeks and months until management is satisfied that it is willing to bet their mission critical apps on it.

          • http://tildehash.com/ TildeHash

            Again, no.

            Only the paranoid would not upgrade to 5.6.0, as it has been thoroughly tested. Software is never “done” as the old saying goes, there will always be bugs reported and fixed, but the point is nothing that would stop a serious project is going to come up, that’s what the RC releases were for, fixing major issues.

            By the way, I’ve never used WordPress, or any CMS.

    • WC

      The latest stable is PHP 5.6 now. But I absolutely agree that nobody should ditch hosts simply for not upgrading on the day of release. That’s ridiculous.

      • http://www.bitfalls.com/ Bruno Skvorc

        Not on the day, but there’s really no excuse to be running 5.3 in an age where it’s in EOL stage. Hostgator offered multiple runtimes at the same time back when I was using them, that’s a good approach, though I don’t know if using shared hosting at all any more can even be called acceptable, in an age of $5 VPS.

        • CTN

          there is one issue with $5 VPSes, which is that they’re self managed, which means developers need to also be Linux system admins.

          and if you install cpanel on them, that instantly adds $20 per month.

  • dojoVader

    A bit closer to PHP-NG,also am waiting for SitePoint to write an article on Yii 2.0 and what to expect. Good work Bruno as usual.

    • http://www.bitfalls.com/ Bruno Skvorc

      So many topics, so few writers.. :)

  • lucasrolff

    You say: “If you use shared hosting, ask them to upgrade. If they don’t have plans to do so, ditch them and show them you don’t support outdatedness.”

    I think you should rather say “please tell customers of webhosts to not run old shit software that isn’t supported by php 5.5, or 5.6″

    A webhosting company usually runs older versions of PHP because they have a lot of customers that runs software that doesn’t work in newer versions of PHP. I would gladly run the newest version of PHP on all servers I have, if I could tell the customer to update their software.

    Sadly that’s not possible.

    When looking on major software in this interwebs such as WordPress and Magento you’ll see that Magento just recently started to support php 5.4.

    WordPress relies on some MySQL_* functions in php which is deprecated, same time tons of other software relies on functions that is only in 5.3 and hopefully in 5.4.

    So stop bitching about hosts not running latest software, instead start bitching about the majority of customers who runs outdated software.

    Analysis shows that most self-hosted solutions such as wordpress, Magento and prestashop gets updated either because people don’t know how to update it or because they’re too lazy.

    • http://www.bitfalls.com/ Bruno Skvorc

      Agreed. Hence the last link in the post.

      • CTN

        Bruno, you’re coming across like a fanatic. calm down and stop waving your hands wildly. people will adopt when they’re good and ready and not because you say so.

        • http://www.bitfalls.com/ Bruno Skvorc

          You’re coming across like a fanatic for the opposite side, so I could argue the same. People will do what they will, and we’ll try to influence their opinion each in our own way

    • http://frustratedtech.com/ frustratedtech

      Ditch your host if they don’t upgrade to a first release of a php version? I read that and almost passed out. What a stupid statement Bruno just did. 5.4 and 5.5 work incredibly well. Shared boxes should be no lower than 5.4 and there is ZERO reason to believe that 5.6 would provide just as stable an experience for those users, in its current state.

    • Bryce

      Couldn’t agree with you more Lucas.

      This article is very deceiving to someone who doesn’t know better.

      While it does include a personal opinion, as a reliable resource that many people find SitePoint to be, this can be very deceiving and hurtful. I am also a hosting provider and run two servers. One with PHP5.4 and the other with PHP5.5 for those whom are interested in it. Forcing your clients to upgrade isn’t always possible and if we don’t take into consideration those clients, what better are we doing it?

      Magento is the leading ecommerce platform out there. I have dozens, if not more running it.

      I’d loose every one of those clients had I listened to your [the author] uneducated recommendations.

      You [the author] seem to be ignorant of the fact so many people run systems that can’t upgrade to a higher version of PHP. You’ll be turning your hosting company into a dictatorship and loosing clients.

      By far probably the worst article I’ve seen on SitePoint and I’ve been a long time fan of this website.

  • http://www.bitfalls.com/ Bruno Skvorc

    We’ve had this discussion in the other post already with dozens of people. Yes, I think we should ditch them. As pointless as it is to state this (but obviously necessary), it’s just my opinion. http://www.thebestpageintheuniverse.net/images/opinion1.gif

  • Taylor Ren

    Something exists from the legacy time in history does not mean it still has every rationale to stay nowadays and beyond.

    Without a platform promoting the best and latest technology, people will tend to be lazy and reluctant to abandon the past and embrace the future.

    As a host of tons of sites, it is their responsibility to set the standard, which may not be the most advanced, but the most accepted AND most advanced. So in my view, a PHP 5.5 is a minimum requirement.

    Ditch them, definitely.

    • CTN

      If you have invested in a particular framework, does it still make sense to ditch it if it does not immediately upgrade to the latest version of PHP?

      I don’t think so.

      5.6 is going to be run now on dedicated servers and VPSes by developers to check it out, and down the line, when people are finished testing their apps on it, they will begin to upgrade production servers to it, but not today.

      • Taylor Ren

        Not today is good enough. We know those guys are on the way and if there is a clear road map, it is OK to give them a grace period before the new platform is ready. But if there is no road map, and when you write to them asking for a one, the reply received is something vague and misty, why not abandon it?

        Tons of frameworks are there in the open market. Tons come and tons go. If the framework that is mentioned in your reply is not committed to embrace the new standard, new platform, my answer is still the same.

        • CTN

          I’m using the Fat Free Framework. minimum requirement is 5.3. I’m not about to drop it if it does not upgrade to 5.6 tomorrow. 5.3 is good enough. I’m still free to use 5.6 myself, if I want to.

  • Michael

    BTW: the next version will be called PHP7, see https://wiki.php.net/rfc/php6. At least that’s what it currently looks like :)

    • http://www.bitfalls.com/ Bruno Skvorc

      Keyword: currently :)

      • snikchnz

        I heard it straight from the horse’s mouth on Thursday that it will be PHP 7. In this case the horse == Rasmus.

  • http://nyasro.com/ Nyasro

    I hope PHP will be best for server side web programming :)

  • CTN

    Doesn’t matter what you call it, it’s not going to be used on production servers until it’s been tested thoroughly first. You’ll see bug fixes coming for it over the next few weeks and months.

    • http://tildehash.com/ TildeHash

      We’ll see bug reports and fixes until 5.6.0 hits end of life in 2017, nothing new. If you’re going to argue 5.6’s likely instability and unreliability, please provide us with evidence of any serious flaw, bug, or exploit found immediately after a production release.

      • CTN

        The point is that management will want to see if bugs are going to affect their app or not, not whether there are random bugs that have no effect.

        all software has bugs. risk management demands that we check if they affect us first before we commit to it.

  • http://vbtechsupport.com/ GEORGE LIU

    Running Xenforo forum on PHP 5.6.0 GA release via Centmin Mod Nginx + PHP-FPM right now https://community.centminmod.com/threads/community-forum-upgraded-to-php-5-6-0-ga-stable-release.1220/ works nicely :)

  • Taylor Ren

    I think the discussion here got a bit off track.

    Magento, WP, are made for daily common usage. Compatibility is of concern. Or those running only 5.2 guys will not be able to run them in their shared host. So from a customer attraction and popularity view, I would do the same if I were the CEO of these platforms. There is nothing to blame on. It is a commercial decision.

    And after all, as you quoted, Magento started to move to 5.4, which is a good sign and in the right direction. We will encourage that and will urge them again, to move further ahead and don’t stop there. And I believe that such a movement is actually good in the sense that more and more hosts will start seriously thinking to enable higher versions of PHP. This is good for overall “level-up”.

    From another perspective, if you are an individual developer, and for example you are to use Symfony 2.x to start your app, how would it be if you find that the latest version of PHP you can use is only 5.1? You will ditch them, right? This happened to me when I found out that my BlueHost vhost only supports to 5.2 at that time when I just redo my web app with SF2. Luckily, BH upgraded the PHP installation in just about 2-3 weeks so I have the patience to retain there.

    Just my thoughts.

  • http://r.je Tom Butler

    Great stuff, would be nice to see an article on how to use PHPDBG

    • http://www.bitfalls.com/ Bruno Skvorc

      I’m told it’s coming :)

  • http://frustratedtech.com/ frustratedtech

    Great reply. PHP was pretty stagnant for years and just recently its been moving extremely rapidly.

  • Fedor

    Wow, you give some of the worst advice possible under “What now?”…. I’m just speechless.

  • Taylor Ren

    Is it my overlooking? I can’t find any description on the internal operator overriding description in the PHP 5.6 release notice. It only mentioned GMP operator overriding, but that is not enough.

  • joefresco

    It’s clear Bruno is not ready to be a CTO. Stability matters more than a version because stuff has to work. PHP is a means to an end not an end to itself.

    Rule 1 to upgrading: Make sure the new version is actually better than the old one.

  • Jack Saat

    I can’t believe that Laravel and both Homestead and forge already got full PHP 5.6 support. I really think that Taylor Otwell is the best that happened to PHP in the last few years! Laravel seems to take PHP so much more closer to ruby and others. And really if you not did already contract Digital Ocean and maybe Laravel Forge! You will be in full control of your own host for a fraction of the price it will cost you elsewhere!

  • CTN

    I upgraded my server to php 5.6.0. do I get a cookie?