PHP7 and the preg_replace problem

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Scam Warning
nicofuma
3.2 Release Manager
3.2 Release Manager
Posts: 528
Joined: Sun Apr 13, 2014 1:47 am
Location: Grenoble - France

Re: PHP7 and the preg_replace problem

Post by nicofuma » Thu Jun 11, 2015 9:19 am

Cin- wrote:
A_Jelly_Doughnut wrote:
Frank Rizzo wrote:Does anyone want to try and find a solution to this? Or shall we just sit talking semantics and be non productive all day?
This week there was a pull request added that will address this problem (for the built-in BBCodes, custom BBCodes require further work). The fix will be merged into "develop" - the branch that is expected to become 3.2 late this year.

Any idea if it is merged already? (the part that can convert old posts), I'd like to test it on my board?
Soon if I find the time to look deeper in it :)
Member of phpBB Development-Team
No Support via PM

Cin-
Registered User
Posts: 57
Joined: Fri Feb 06, 2015 2:06 pm

Re: PHP7 and the preg_replace problem

Post by Cin- » Fri Jun 12, 2015 8:54 am

nicofuma wrote:Soon if I find the time to look deeper in it :)
Excellent, looking forward to it!

omniError
Registered User
Posts: 15
Joined: Sat Jul 05, 2014 6:41 pm

Re: PHP7 and the preg_replace problem

Post by omniError » Thu Jun 18, 2015 5:56 pm

nicofuma wrote:Otherwise, 3.2 should be released at the end of the year, around November. This version should already be compatible with php7 for a new board but it's not for an existing board which already have some posts (they all have to be converted and this part isn't already available).
Is it planned to be able to convert <3.2 posts into the 3.2+ format, or will there be two bbcode processors working behind the scenes? If the latter then it doesn't solve this preg problem.

nicofuma
3.2 Release Manager
3.2 Release Manager
Posts: 528
Joined: Sun Apr 13, 2014 1:47 am
Location: Grenoble - France

Re: PHP7 and the preg_replace problem

Post by nicofuma » Thu Jun 18, 2015 7:45 pm

Both actually. The part of the old parser still alive in 3.2 should be mostly php7 complient (someone decided to work on it) and the old posts will be converted (we are working on it)
Member of phpBB Development-Team
No Support via PM

Miri4ever
Registered User
Posts: 392
Joined: Sat Mar 07, 2015 11:18 am

Re: PHP7 and the preg_replace problem

Post by Miri4ever » Wed Jan 06, 2016 4:23 pm

I'm running PHPBB 3.1.6 and my Hoster is now starting to setup his servers with PHP 7.0 soon. So how far is the coding today since a few days passed while this topic was started ?
Homepage: Terra Oceanica

User avatar
SiteSplat
Registered User
Posts: 72
Joined: Sun Sep 07, 2014 7:17 pm
Contact:

Re: PHP7 and the preg_replace problem

Post by SiteSplat » Wed Jan 06, 2016 5:13 pm

The team is working on it. Sometimes the planned dates are not respected and this is due to good reasons (like the above) We are still in alpha after all. Hang in there. ;)

Frank Rizzo
Registered User
Posts: 117
Joined: Sun Jan 05, 2003 11:10 pm
Contact:

Re: PHP7 and the preg_replace problem

Post by Frank Rizzo » Wed Jan 06, 2016 7:39 pm

If you can upgrade the board to 3.2 php7 will work with it perfectly.

User avatar
kinerity
Registered User
Posts: 1118
Joined: Mon Sep 01, 2014 1:00 am
Name: Kailey Truscott
Contact:

Re: PHP7 and the preg_replace problem

Post by kinerity » Wed Jan 06, 2016 7:54 pm

Frank Rizzo wrote:If you can upgrade the board to 3.2 php7 will work with it perfectly.
3.2 is NOT recommended for use in live environments yet
phpBB3 Refugees - Unofficial phpBB 3.0.x support

Image

User avatar
Solidjeuh
Registered User
Posts: 522
Joined: Wed Oct 06, 2010 11:20 pm
Location: Aalst / Belgium
Name: Andy Dm
Contact:

Re: PHP7 and the preg_replace problem

Post by Solidjeuh » Thu Jan 07, 2016 8:59 pm

I installed php 7.0.1!
So bring me the phpBB 3.2! :lol: :lol:
I don't suffer from insanity. I enjoy every minute of it.

User avatar
null2
Registered User
Posts: 382
Joined: Wed Jan 20, 2010 11:03 am

Re: PHP7 and the preg_replace problem

Post by null2 » Sat Mar 05, 2016 12:41 am

Solidjeuh wrote:I installed php 7.0.1!
So bring me the phpBB 3.2! :lol: :lol:
+1
Sorry for my bad english. I'm from USA.

Jbbc
Registered User
Posts: 7
Joined: Wed Apr 28, 2010 3:03 am

Re: PHP7 and the preg_replace problem

Post by Jbbc » Mon Apr 04, 2016 2:29 am

nicofuma wrote:As said above I don't think that so much hoster will update to php7 soon
OVH (first European hosting company, something like the 3rd worldwide) does. And have been for some time. Including its low cost hosted plans.

And with the speed improvement of PHP7, a lot of people are looking into it. It's not at all comparable with previous PHP update on that front.

gnif
Registered User
Posts: 8
Joined: Mon Apr 04, 2016 3:20 am
Contact:

Re: PHP7 and the preg_replace problem

Post by gnif » Mon Apr 04, 2016 3:41 am

Hi.

Figured I would register here and post my success with PHP7 and phpBB 3.1.6. I have been comissioned to build, tune and move a client's phpBB forum to a high availaibility cluster, this forum boasts a 32GB database with over 30 million posts, and during peak periods exceeds 20,000 concurrent users.

Before we started their old configuration was:
  • Front End Reverse Proxy
  • 2x Apache Web Servers
  • 1x MySQL 5.1 database.
First stage of the migration was to move from Apache to Nginx + PHP5.6 fpm. This gave conciderable performance increases tripling the throughput of the website, but it was still not enough as the servers were still getting overloaded.

My client agreed to move away from their clould VM environment to a cheaper, yet much more powerful dedicated server enivornment consisting of a total of 6 servers configured as follows:
  • 2x frontend load balancers with a floating IP for high availaibility.
  • 2x 16 core (32 threads) web servers with 32GB of ram.
  • 2x 16 core (32 threads) database servers with 64GB of ram.
  • All servers on a 1gbit private LAN for internal communications.
For the databases we used percona-server with galera clustering, and a HAProxy to distribute the load to the two servers. The servers were configured to use hugepages and are capable of keeping the entire database in ram which we converted to InnoDB. We did initially experiment with ProxySQL but found its performance to be rather lacking and did not handle network saturation well, thus the switch to HAProxy. A floating IP was also assigned to the database servers, and keepalived was configured to keep it online. This IP was used as the phpBB database host.

On the web servers we initially got things working using Nginx + PHP5.6 fpm, and saw some fairly decent performance metrics when testing with apachebench, on average we were 3.5x faster then the old configuration at this point per server, not across all servers :).

At this point we were obtaining around 400 requests per server (total of 800) at a concurrency of 30, which was saturating the CPU resources on the web servers. We next performed some profiling and found a some methods that could have done with a tune up (specifically get_moderators), this increased the server throughput to around 450rps.

As an experiment we decided to trial PHP7 on one of the servers and saw a large performance improvement, but obviously the preg_replace issue everyhone else here has reported. We spent the next day patching every occurance of preg_replace with the 'e' modifier to use preg_replace_callback with Closure methods, retaining 100% compatibility with the existing code, which gave us a fully working phpBB3 forum on PHP7.

The net result of all this is, each server is able to serve 655 requests per second, which fully saturates the private 1gbit network between servers. If we were to move to a 10gbit network we would be capable of 1,300 requests per second.

Edit: It was discovered that the database connection was actually the bottleneck with full network saturation, so we enabled compression on the connection (MYSQLI_CLIENT_COMPRESS on mysqli_real_connect) which gave us a futher performance increase, we now see over 1000 requests per second per server, giving a net total of 2000 requests per second capacity. Unfortunately at the load balancers we still only see a little over 1000 requests per second due to network saturation between the web servers and load balancers.

We hope to go live with the new environment in the coming week, when we do I will update this forum with the details if my client permits.
Last edited by gnif on Tue Apr 05, 2016 6:53 am, edited 4 times in total.
HostFission - Full server management and consulting services.

User avatar
Ger
Registered User
Posts: 1088
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: PHP7 and the preg_replace problem

Post by Ger » Mon Apr 04, 2016 7:53 am

Jbbc wrote:
nicofuma wrote:As said above I don't think that so much hoster will update to php7 soon
Right after that, he also wrote:
nicofuma wrote:(or at least without providing an option to choose between an up to date version of php5 and php7)
And that's true for the foreseeable future. Many software is now being adapted to work with PHP 7 but it takes time. It's not good to just quick fix some stuff and launch a new update package while praying other stuff doesn't break. phpBB has proven to be darn stable forum software and I for one prefer that stability to quick releases.

Now as stated on the blog last week 3.2 is near and to be expected before summer. It is in BETA now, so if you want to speed things up you might want help and test.
Checkout my extensions: Simple CMS, Feed post bot, Modbreak, Magic OGP links and Live topic update

Like my work? Buy me a coffee to keep it coming. :ugeek:

gnif
Registered User
Posts: 8
Joined: Mon Apr 04, 2016 3:20 am
Contact:

Re: PHP7 and the preg_replace problem

Post by gnif » Tue Apr 05, 2016 8:42 am

Ger wrote:Many software is now being adapted to work with PHP 7 but it takes time. It's not good to just quick fix some stuff and launch a new update package while praying other stuff doesn't break. phpBB has proven to be darn stable forum software and I for one prefer that stability to quick releases.
Correct which is why when we needed to move to PHP7 I patched 3.1x correctly. To be honest I do not understand why phpBB state it is such a large undertaking to fix this, it took me a day to go around and fix all the instances of it. This wont break backwards compatibilty with old PHP versions either, it has existed since PHP4, and to be honest it is abysmal that phpBB has not yet been updated to use it.
HostFission - Full server management and consulting services.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 16467
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: PHP7 and the preg_replace problem

Post by DavidIQ » Tue Apr 05, 2016 3:24 pm

gnif wrote:Correct which is why when we needed to move to PHP7 I patched 3.1x correctly. To be honest I do not understand why phpBB state it is such a large undertaking to fix this, it took me a day to go around and fix all the instances of it. This wont break backwards compatibilty with old PHP versions either, it has existed since PHP4, and to be honest it is abysmal that phpBB has not yet been updated to use it.
Changing code and making it work for one single installation of phpBB is one thing, but when you take into consideration that there are thousands of installations of phpBB 3.1.x with varying board and server configurations, all using hundreds or even thousands of different custom BBCodes, and that the current release is stable for all of those it would be irresponsible of us to suddenly make a change that would affect 100% of all updated installations without knowing if those installations would still work or not or if there will be data loss.

@Everyone else: We have committed to fully supporting PHP7 in 3.2 and the developers have rewritten the post and BBCode parser to that end. The final/gold release is slowly coming together, but we want to test a bit longer so that large bugs don't suddenly come up, as has already been the case (this is the point of alpha and beta releases). In the meantime very few, if any, hosters are going to go the route of only supporting PHP7 because there are large PHP projects that aren't PHP7 compatible so I would just wait for 3.2 to come around to it's final release and stick to PHP 5.6 in the meantime.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

Post Reply

Return to “phpBB Discussion”

Who is online

Users browsing this forum: joenglish and 16 guests

cron