Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

coldKingdom's avatar

Is it just me, or is PHP 7 slow?

When reading about PHP 7 it seems to be extremely nice and fast. So my expectations were quite high and still are, and therefore I installed it on my local debian server for testing and still my hunger for bleeding edge stuff.

I fired up my Laravel project and looked at the debugbar for some information.

PHP 5.6.12

Memory: 5.25mb
Execution time: 32,92ms

PHP 7

Memory: 10mb
Execution time: 178,87ms

Is anyone experiencing this slowness and double usage of memory, and maybe have nice solution for it?

I have just installed it, no settings other than default just as I did for PHP5.

0 likes
14 replies
ohffs's avatar

All the testing I've done with it show it being faster and using less memory - not sure why you're seeing odd results. Possibly 32/64bit on the memory side?

coldKingdom's avatar

@ohffs I'm running 64-bit all the way, or maybe you mean something else? Sometimes the language barrier is in the way :)

ohffs's avatar

@coldKingdom ah - it was just a guess based on the roughly double on the memory - just a co-incidence I guess :-) It was about a month ago I did some testing, possibly things have changed in the meantime. I'm downloading RC1 just now so I'll give it a compile and let you know what it does with my code :-)

ohffs's avatar

@coldKingdom this is just a very quick test using a basic phpunit run (32 tests with an sqlite backend). It's a CentOS 6 box so I'm comparing against the stock php5.3 (I might compile 5.6 after breakfast though) :

PHP 5.3 : Time: 1.73 seconds, Memory: 31.25Mb

PHP 7.0RC1 : Time: 1.06 seconds, Memory: 14.00Mb

The times vary a bit each time - but that's the general picture for me :-)

coldKingdom's avatar

@ohffs Thank you very much for your information! Seems like a massive improvement against 5.3. Maybe I have to investigate a bit further on a clean OS install :)

ohffs's avatar

@coldKingdom I've run the tests against a fresh compile of 5.6 - so now I have :

PHP 5.3 : Time: 1.73 seconds, Memory: 31.25Mb

PHP 5.6 : Time: 1.17 seconds, Memory: 20.75Mb

PHP 7.0RC1 : Time: 1.06 seconds, Memory: 14.00Mb

Interestingly (or not!) I ran a make tests on the php7 build and it reported a couple of memory leaks - it's possible your code is hitting something that's leaking and mine aren't. Or it's just one of these mysterious IT things that keeps us all guessing ;-)

ohffs's avatar

@coldKingdom as I'm bored today and trying to avoid doing the housework, I built a copy of php7 against a bigger project that was using 5.6 previously. Unit tests running against mysql this time - it's quite a pronounced "win" for php7 :

PHP 5.6.10 : Time: 8.48 seconds, Memory: 38.50Mb

PHP 7.0RC1 : Time: 4.27 seconds, Memory: 6.00Mb

2 likes
coldKingdom's avatar

@ohffs I really appreciate you taking the time to do the testing. I really need to take some time to dig deeper. I will get back to you with some testing myself once I find the time to do it :)

ohffs's avatar

@coldKingdom I look forward to seeing your results :-) I notice PHP7 is now available on laravel forge as a beta option :-)

thehal84's avatar

I think I am observing similar results with testing our applications, PHP 5.6 vs 7.0 RC3. The only variable changed between tests was the version of PHP, all other OS and server configs kept constant including FPM pool. Both KVMs on the same private subnet.

Test Server: KVM 2vCPU 1GB RAM 10GB SSD Ubuntu 14.04 x64 Apache 2.4 + PHP-FPM

Test Client: KVM 2vCPU 1GB RAM 10GB SSD Ubuntu 14.04 x64

Test: ab -n 2000 -c 50 http://example.com (executed 3 times)

PHP 5.6.13 = 554 req / second PHP 7.0 RC3 = 201 req / second

2 likes
hle's avatar

I've noticed this too. Installed PHP7 from zend, and my pages are slower as well. Eg, 700ms to 1.9s.

Had the same results with ubuntu php7 ppa.

It seems like the performance is better for command line (php benchmark.php or phpunit), but worse for web applications.

Zizaco's avatar

I'm having similar results with our applications.

On a high load, our Laravel application used to respond in 300ms at maximum. Now it responds in 500ms in a similar situation.

On the average, it's been about 40% slower than php 5.6. With the very same specs (c1.xlarge - AWS) and the minimum changes necessary to run PHP 7.

I've tryed to find any differences in configs ($ php -i) that may be causing this, but coudn't find anything yet.

Does any of you have any new insight on this?

Ark4ne's avatar

Simple question, you have OPCache enabled ?

Out of curiosity, you can show your configuration ?

Because on one app I went from 300 ms average response to 160ms. And 16MB to 9MB per process.

~ Debian 7 ~ Laravel 5.2 ~ PHP7.0.4 ~ nginx

Please or to participate in this conversation.