PHP mysqli session error in SocialEngine on Mavericks Server 3 (OS X 10.9)

After installing SocialEngine 4 (4.8.6) on my Mac mini running Mavericks Server 3 and PHP 5.4.27, SocialEngine pukes with a error:

exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli statement execute error : Duplicate entry

Read on for a solution:

The cause is two-fold: 1) SocialEngine expects a 32-character hash such as supplied by MD5; and 2) PHP in Mavericks Server 3 uses SHA-512 as the default, generating 128 characters.

I’ve encouraged SocialEngine to support the vastly more secure SHA-512 hashing.

Until then, here’s the fix:

in /Library/Server/Web/Config/php/php.ini, comment out this line with a semi-colon:

session.hash_function = sha512

When testing this solution, make sure you delete the session ID in engine4_core_session in your database, AND delete the cookies for the domain from your browser.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.