PHP 7.0.0 released

If anyone is still using the old mysql_*() functions, please just stop now and switch to either the mysqli extension or the PDO extension, either of which allows you to use prepared statements with bound parameters so you no longer have to (forget to) use mysql_real_escape_string().

Removed extensions and SAPIs in PHP 7

    I'm so happy. Hopefully we can use it in production by 2025 when hosts start including it!

      Bonesnap;11052593 wrote:

      I'm so happy. Hopefully we can use it in production by 2025 when hosts start including it!

      Just spin up your own VM with whatever version you want on AWS or on Laravel Forge. 🙂

        http://derokorian.com powered by 7.0 🙂

        1 product in my company will be on 7.0 in january (the other 2 products are on 5.3, rewrite starting in Jan as well)

          Derokorian;11052601 wrote:

          http://derokorian.com powered by 7.0 🙂

          1 product in my company will be on 7.0 in january (the other 2 products are on 5.3, rewrite starting in Jan as well)

          Any new features in particular that you are using, or just getting the performance boost? (Just curious)

            NogDog;11052607 wrote:

            Any new features in particular that you are using, or just getting the performance boost? (Just curious)

            The performance boost is nice. Also using scalar type hints and return types. That's all I've done for my site. As for the product at work, that won't be using any features (as of yet) but it works, and this particular product is our primary server cost, so it'll be nice to do more with less 🙂

              NogDog;11052599 wrote:

              Just spin up your own VM with whatever version you want on AWS or on Laravel Forge. 🙂

              Personal code and servers are one thing. I am talking about at work where I have 0 say in what clients do for their hosting (we do not provide it). Most hosts aren't going to have this ready to go for a while. GoDaddy, for example, state on their website that they offer 5.3 through to 5.5 🙁. But I do give credit to 1and1.ca as they offer PHP7 (and offered it months ago as an experimental option if you wanted to test).

              Personally I'm looking forward to most of the new features. The speed improvement is just icing on the cake. The spaceship operator makes custom sorting functions way easier, and the null coalescing operator does away with ternary operators/expressions. The scalar type hints and return types are pretty cool, too. Just overall excited for it but since it's a major version change adoption will be slow. Have you heard that there's currently an RFC about extending 5.6's support? Largely because the adoption of 7 isn't going to be widespread enough where they can (basically) retire the entire 5.x branch and rely on 7. I feel like the developers working on PHP should have seen that coming from a mile away.

                Bonesnap wrote:

                I feel like the developers working on PHP should have seen that coming from a mile away.

                Like... that time they wanted to get everyone to switch to PHP 5? 😃

                I prefer to stick to the official repositories for Ubuntu, and then I normally stay on Long Term Support releases, so at the moment I am still on PHP 5.5. It looks like the next LTS is still slated to have PHP 5.6 in its official repositories, so if that does not change, there will be a hiccup where security support for PHP 5.6 ends in August 2017, but the LTS version of Ubuntu after that will only arrive in April 2018.

                  laserlight;11052703 wrote:

                  Like... that time they wanted to get everyone to switch to PHP 5? 😃

                  Probably! But I wasn't coding back then, or at least not aware of the PHP versions, so I was able to avoid that catastrophe 🙂 Also now it seems the PHP team are a lot more aggressive with retiring older versions.

                    First off, when I was at ZendCon back in October, there were already hosts providing 7.0 RCs. Just like every other version that has come out, if your host doesn't provide it by the first patch version then you should switch hosts 😛

                    Second, from my experience I can expect many shared hosts to upgrade much quicker than with 4 to 5. This is for 2 main reasons: A) the performance improvement means hosting more customers on less servers and 😎 its a much less painful upgrade for users than previous major versions. AFAIK it is a very easy path to upgrade, if you're not using new features AND your code worked on 5.6 in strict mode THEN you should be good to go to upgrade (IE I now have 7 projects running on 7.0 in production, and only 1 needed any code change at all).

                    Third, LTS distros usually back port security fixes into their provided version of software even after the software maintainers themselves say its not longer supported. So as long as your version of Ubuntu continues to be under LTS, and you continue to keep the php package up to date you should be fine. In the past, the core team has helped with security fixes for LTS distros even after EOL due to high potential for abuse.

                    As for the RFC to extend support for 5.6 - its current voting options are a) don't extend, b) extend active support to 1 year from 7.0 release date, with 1 year of security support following or c) extend active support to 1 year from 7.0 release date with 2 years of security support. Which really means, there is 2 options to extend active support for an extra 4 months, and 1 option to give an extra year of security. That's not a big extension - and my understanding following internals it its likely to be option B that wins out.

                      I keep finding mysql_connect and friends in code I have written within the last 5 years.

                      To be fair, for a while mysqli_connect was NOT AVAILABLE on a production box (After a couple years I asked, "WTF?" to the hosting company).

                      Of course, this same hosting company probably won't have PHP 7 for a few years yet either ...

                      Bonesnap wrote:

                      I'm so happy. Hopefully we can use it in production by 2025 when hosts start including it!

                      Exactly....

                        Ooh, also: As LaserLight notes, I pulled down the latest ports tree from FreeBSD.org yesterday, and 5.6 is still the de facto ultimate release there ...

                          dalecosp;11052721 wrote:

                          Ooh, also: As LaserLight notes, I pulled down the latest ports tree from FreeBSD.org yesterday, and 5.6 is still the de facto ultimate release there ...

                          I have often wondered what the big delay is with Ubuntu and the PHP versions. Ubuntu 12LTS will be around until 2017 and yet it uses PHP 5.3 (with security patches applied of course). PHP 5.3 was retired August of last year. PHP 5.4 was retired in September of this year. Ubuntu 12.04LTS was released in April 2012 -- at which point PHP 5.4 at least would have been available.

                          One wonders if the Ubuntu squad could have tried a little harder and gotten php 5.4 in there -- but even if they had it has still been retired. One also wonders what the harm would be in switching Ubuntu 12 LTS's official version of php from 5.3 to 5.4 or 5.5 or 5.6. It is the LTS release of course and so it must therefore be stable. I find it hard to imagine what, if anything, would be broken in one's code by switching from 5.3 to 5.6. The only thing that comes to mind is the passing of values and/or functions by reference. I vaguely recall some complaints in newer versions of PHP about passing parameters by reference:

                          Note: There is no reference sign on a function call - only on function definitions. Function definitions alone are enough to correctly pass the argument by reference. As of PHP 5.3.0, you will get a warning saying that "call-time pass-by-reference" is deprecated when you use & in foo(&$a);. And as of PHP 5.4.0, call-time pass-by-reference was removed, so using it will raise a fatal error.

                            Write a Reply...