Jump to content
Pierre-Luc

PHP 7 coming soon!

Recommended Posts

Hey guys! You probably have been following the recent announcements regarding the next PHP version, 7..

I'm pretty excited about scalar type hinting, return type declarations (although void didn't pass :( ) and much improved performance!

What are you most looking forward to, what are you sad isn't there?

Some extra reading:

- PHP RFCs — https://wiki.php.net/rfc/howto

- Fun little infographic from Zend — https://pages.zend.com/TY-Infographic.html

  • Like 3

Share this post


Link to post
Share on other sites

Hehe, I was going to open up a topic this morning - beat me to it! ;-)

I'm quite excited, and very much looking forward to working with it.

Return types look cool - I see they still need to add support for a whole bunch of them. I agree with there not being a void return type though. If I'm not returning anything, then I shouldn't need to declare a type.

Btw, you've linked to the infographic twice... ;-)

Share this post


Link to post
Share on other sites

Greetings,

This is very exciting. I'd be curious to know what this means for ProcessWire.

One very noticable point: check out the performance of Drupal in graphic #4!

Thanks,

Matthew

Share this post


Link to post
Share on other sites

I'm personally really not that interested in the development front of php. As long as I have to even switch servers of clients that the minimum requirements for PW are met I can't possibly benefit from anything mentioned there. I'm happy if I have php >= 5.4. 

  • Like 6

Share this post


Link to post
Share on other sites

But that performance increase might be nice for servers where you could request an upgrade :)

  • Like 2

Share this post


Link to post
Share on other sites

@LostKobrai, well in general terms type hinting is a good sanity check when developing anything remotely complex. The fact that you can hint any class but not string, arrays, int or else has always been an annoyance of mine (not passing the right type will give a fatal error).

Most of these are niceties I agree though. I'm mostly excited to run benchmarks on non cached PW instances. Can it really get any faster ? Will the page load before even clicking links ? ;P

  • Like 1

Share this post


Link to post
Share on other sites

It's very rare to php be a bottleneck regarding most websites and apps. 2 sec pageload contains very little php processing. So huge performance boost there will give very little to overall loading times.

Not saying it's bad thing (of course not), but most of the usual website performance is front end.

  • Like 1

Share this post


Link to post
Share on other sites

There are resource-intensive tasks, though, and especially for very dynamic sites where caching is less helpful this could be a good thing. I'll admit that it probably doesn't mean shit for my personal site, but in the case of large services (or if you're hosting a lot of stuff) smaller savings here and there add up.

So, if anyone's looking to build the next Facebook completely in PHP, better wait until 7 is out. Would be interesting to hear how PHP7, with all it's speed improvements, compares to HHVM though.. or is that comparing apples to oranges?  :)

I'll have to agree with LostKobrakai too. It'll take a very long time until this is widely used. For the most part 7 coming out will just mean that we can start using it for our own, cutting-edge projects (or projects big enough to justify setting up a customised server environment).

  • Like 2

Share this post


Link to post
Share on other sites

I've got PHP 7 running on my home computers and everything works like a charm. I can't say anything about massive speedups (everything's in the <10% range so far) but then, the complexity of my home playground is rather limited, but I'll start load testing in the company in January and hope to find some more impressive figures there. What bugs me a bit is that I haven't found a working server-based memory cache for Windows yet. Memcached, Redis, you name it, it's not yet available. I'm curious if I missed something there. Are there any in-memory key-value storage servers for Windows with PHP 7 support worth taking a look at?

Share this post


Link to post
Share on other sites

Just tried it on a rather old test installation (default profile) and it worked like a charm. This Thing Is Flying! HipHop VM (HHVM) I tried before, it's also quite fast but I'm not sure about the coverage in more complex systems. 

Share this post


Link to post
Share on other sites

Well, according to my short tests with very unscientific methods, HHVM still overtakes PHP, runs to the finish line and back to start just to overtake PHP again. 
 
With a normal ab -c20 -n500, HHVM is approximately 24 times faster than PHP 7, under higher load (-c100) this scales up to 60 times. Then the saturation is reached for this small server I'm testing this against. Of course, both are tested out of the box and with a PHP opcode cache you could actually gain more performance.

EDIT: Caching was still on, the numbers are wrong. The server was delivering static pages. However, this is a good demonstration of fcgi_cache.

 
However, PHP7 is still super fast compared to 5.4 or 5.5 – and probably has less side effects in large production environment. Or at least they are documented. Let's say it like this: if you have moderate traffic on your site and your application is decently written, you will probably won't note much of a difference. And if you have high traffic, you might face other bottlenecks than PHP, especially if you work with highly dynamic content.

  • Like 2

Share this post


Link to post
Share on other sites

hhvm works with a language called hack which is similar to php, example:

<?hh echo "Hi, I'm a Hack script!";

Will this ever work with Processwire ? Do you have an example how to install hhvm on a day to day host out there ?

Share this post


Link to post
Share on other sites

hhvm works with a language called hack which is similar to php, example:

<?hh echo "Hi, I'm a Hack script!";
Yes, but HHVM is also a JIT compiler to PHP like V8 for JavaScript.

Will this ever work with Processwire ? Do you have an example how to install hhvm on a day to day host out there ?

Yes, in fact it does. I'll make a tutorial the next days.
  • Like 3

Share this post


Link to post
Share on other sites

I couldn't believe my own numbers, so I checked again. Turns out, HHVM still had caching enabled – my bad. It's still faster, but these numbers are not real. It's rather 1.5x faster. I have to get a bigger server to see how it scales out on multiple CPUs and when it's hitting limits.

I will not longer reply on this thread, as it is about PHP7. I made a new one.

Share this post


Link to post
Share on other sites

Well, now I come back with something PHP 7 related. So if you upgrade your server to PHP7 and you happen to have PHP run as php-fpm, then DO NOT FORGET to install php7.0-mysql. I was scratching my head for almost half an hour where this strange 500 error stems from. Everything was working fine (info.php, some tests, another website), until I figured that the difference between "the other site" and my PW site was the database.

Just a heads up, keep it in mind when you run into an error :)

Share this post


Link to post
Share on other sites

So, is the answer YES processwire is compatible with PHP 7?

Well I am running PW 2.7 in OVH shared hosting with PHP 7 and no issues so far.

  • Like 1

Share this post


Link to post
Share on other sites

i'm running a site in production on PHP7, no problems. depends a lot on the modules you use i guess. core should be no problem at all.

  • Like 1

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...