News:

Wondering if this will always be free?  See why free is better.

Main Menu

SMF 2.0.11 and php 7

Started by spiros, October 28, 2015, 09:45:20 AM

Previous topic - Next topic

sah62

After updating my OS from Ubuntu 14.04.4 LTS to 16.04.1 LTS and PHP 7 I ran into the mysqli issues described earlier in this thread. Here's a quick summary of what I've done to fix the issues for anyone else who bumps into them:

I manually installed this mod: http://custom.simplemachines.org/mods/index.php?mod=3469. I also had to add "$db_type = 'mysqli';" to Settings.php to make it all work.

From there I saw a consistent pair of error messages in my error log:

QuoteUnknown: Session callback expects true/false return value

To fix this error I had to edit Sources/Load.php to make the changes described here:

https://github.com/SimpleMachines/SMF2.1/commit/dd4222bc9af04355db14c5cdf0925e24ea791eaf

QuoteUnknown: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/lib/php/sessions)

I still haven't figured this one out. The value for session.save_path is correct, for now I have permissions set to 777, and the error still appears. Any thoughts?

sah62

Quote from: sah62 on August 07, 2016, 11:11:22 AM
QuoteUnknown: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/lib/php/sessions)

I still haven't figured this one out. The value for session.save_path is correct, for now I have permissions set to 777, and the error still appears. Any thoughts?

Some progress: I found information describing a bug in PHP related to the warning message:

https://bugs.php.net/bug.php?id=71070

The implemented bug fix returns a different message ("Failed to write session data using user defined save handler") if there's a custom save handler involved. That got me looking at the sessionWrite function in Load.php; the warning is triggered if this function returns boolean false. The SMF 2.1 patch described above makes this change:


- return $result;
+ return ($smcFunc['db_affected_rows']() == 0 ? false : true);
}


So now this looks like a situation in which the attempt to either add a row to the session table or update an existing row has failed. How might that happen?

sah62

Quote from: sah62 on August 09, 2016, 12:21:58 PM
So now this looks like a situation in which the attempt to either add a row to the session table or update an existing row has failed. How might that happen?

More progress: with a little more digging I discovered (http://stackoverflow.com/a/5389008) that you can't depend on $smcFunc['db_affected_rows']() to produce a non-zero value if you're using mysql. The sessionWrite function uses the value returned from $smcFunc['db_affected_rows']() to determine the return value for the function; that's probably not the right thing to do. Here's a fix to the code in the sessionWrite function:


        - if ($smcFunc['db_affected_rows']() == 0)
        + if ($result == false)
                $result = $smcFunc['db_insert']('ignore',
                        '{db_prefix}sessions',
                        array('session_id' => 'string', 'data' => 'string', 'last_update' => 'int'),
                        array($session_id, $data, time()),
                        array('session_id')
                );

        - return $result;
        + return ($result == false ? false : true);

JerzyLS

Hello,

SMF 2.0.11 on PHP 7 didn't detect ACPu, OPCache or Memcached.

Is it possible to solve?


MobileCS

This is from the other thread :

QuotePerhaps. The good news is it shouldn't be a discussion point for much longer as we will be PHP 7 compatible soon. Locked for now :). Enjoy the holidays all.

Anyone know how soon 2.0.x will be PHP 7 compatible?

This forum software is the only thing holding me back from upgrading. The new PHP version is so much faster and uses less memory than the 5.x version.

d3vcho

We still working on it, but we never give dates for upcoming releases. If we don't have any setback, the release will be soon.
"Greeting Death as an old friend, they departed this life as equals"

Arantor

Has anyone actually benchmarked the memory usage and speed specifically for SMF on 5.6 vs 7 for those who've done the tweaking? Sure, for heavy class use PHP-NG will outperform Zend Engine 2.x. SMF doesn't heavily use classes. Ditto on variable allocation and garbage collection; most of SMF's variables are globally allocated and reused, plus a fair amount of stuff passed around by reference which was always faster anyway.

In reality, the bottleneck on SMF has been the database for years now and you need to be up into the millions of posts category before that starts to change, and there are many more things you can do before that to improve the situation. I don't really see PHP 7 changing it nearly as much as people think, but once I see actual benchmarks, maybe that'll be different.

MobileCS

To be honest, I'm not concerned about the performance or memory savings with SMF and PHP 7. It runs great for me right now.

However, I am concerned about how much of a performance boost it will give my other projects running on this dedicated server. I'm looking at almost 3x the speed boost with pretty big memory savings. Of course none of this can happen until SMF 2.0.x is PHP 7 compatible ...

huns

Quote from: Arantor on January 02, 2017, 06:33:34 PM...

It's not about performance but support.
PHP5 is getting more obsolete day by day.
Ubuntu 14.04 is the last Ubuntu now that can run SMF - and while there is still 2 years of support, SMF 2.1 has been in the works for several long years now.

I am very thankful for every contributor's work, and I don't really care about the new version, just saying that time is running out.

Arantor

That was an answer to a comment two months ago about performance. Please don't take it out of context to misrepresent it.

ForumGuy789

Hey guys, hate to pile on here but many older versions of CPanel will end their support lifespan on March 31st, 2017. And they won't be supporting some 32 bit operating systems anymore like CentOS6 after that date. What this means is that tons of people are having to migrate to 64 bit machines with new CPanel versions and don't even have the option for php 5.x as far as I know. If it is an option it's a messy one. Would be awesome if smf  could support 7.0 soon.

I def appreciate the work you guys put in.


Kindred

And, as has alreayd been stated, when 2.0.14 is released, it will
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Steve

As the OP's question has been asked and answered (amongst other questions) I'll go ahead and mark this solved.
DO NOT pm me for support!

Advertisement: