Advertisement:

Author Topic: SMF 2.0.11 and php 7  (Read 29424 times)

Offline sah62

  • Semi-Newbie
  • *
  • Posts: 67
Re: SMF 2.0.11 and php 7
« Reply #40 on: August 07, 2016, 11:11:22 AM »
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:

Quote
Unknown: 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

Quote
Unknown: 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?

Offline sah62

  • Semi-Newbie
  • *
  • Posts: 67
Re: SMF 2.0.11 and php 7
« Reply #41 on: August 09, 2016, 12:21:58 PM »
Quote
Unknown: 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:

Code: [Select]
- 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?

Offline sah62

  • Semi-Newbie
  • *
  • Posts: 67
Re: SMF 2.0.11 and php 7
« Reply #42 on: August 09, 2016, 12:41:24 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:

Code: [Select]
        - 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);

Offline JerzyLS

  • Semi-Newbie
  • *
  • Posts: 64
Re: SMF 2.0.11 and php 7
« Reply #43 on: September 14, 2016, 05:55:45 AM »
Hello,

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

Is it possible to solve?

Offline vivien

  • Semi-Newbie
  • *
  • Posts: 17
Re: SMF 2.0.11 and php 7
« Reply #44 on: November 02, 2016, 01:45:09 PM »
Another thread, for SMF 2.0.11 and PHP 7 : http://www.simplemachines.org/community/index.php?topic=548881

Offline MobileCS

  • Jr. Member
  • **
  • Posts: 124
Re: SMF 2.0.11 and php 7
« Reply #45 on: January 02, 2017, 05:12:49 PM »
This is from the other thread :

Quote
Perhaps. 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.

Offline d3vcho(void)

  • Localizer
  • SMF Hero
  • *
  • Posts: 2,241
  • Gender: Male
  • Be prepared for hell
    • d3vcho on GitHub
    • @SMF_ES on Twitter
Re: SMF 2.0.11 and php 7
« Reply #46 on: January 02, 2017, 05:36:46 PM »
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.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,032
    • Arantor on GitHub
Re: SMF 2.0.11 and php 7
« Reply #47 on: January 02, 2017, 06:33:34 PM »
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.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline MobileCS

  • Jr. Member
  • **
  • Posts: 124
Re: SMF 2.0.11 and php 7
« Reply #48 on: January 02, 2017, 10:13:49 PM »
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 ...

Offline huns

  • Semi-Newbie
  • *
  • Posts: 42
Re: SMF 2.0.11 and php 7
« Reply #49 on: March 15, 2017, 05:33:23 AM »
...

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.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,032
    • Arantor on GitHub
Re: SMF 2.0.11 and php 7
« Reply #50 on: March 15, 2017, 05:54:11 AM »
That was an answer to a comment two months ago about performance. Please don't take it out of context to misrepresent it.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline ForumGuy789

  • Jr. Member
  • **
  • Posts: 143
Re: SMF 2.0.11 and php 7
« Reply #51 on: March 15, 2017, 10:15:54 PM »
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.


Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,098
  • Gender: Male
    • Kindred-999 on GitHub
Re: SMF 2.0.11 and php 7
« Reply #52 on: March 15, 2017, 10:22:44 PM »
And, as has alreayd been stated, when 2.0.14 is released, it will
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Steve

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 3,927
  • Gender: Male
  • I have not yet begun to procrastinate.
Re: SMF 2.0.11 and php 7
« Reply #53 on: March 17, 2017, 09:57:57 AM »
As the OP's question has been asked and answered (amongst other questions) I'll go ahead and mark this solved.
Please do not PM me for support.