changing php version

I have Zenphoto version 1.5.7 installed running on php 7.1. When I change the php version via cpanel to 7.2 my webpage disappears completely and I get the following errors:

server error log:

[29-Apr-2021 22:34:32 Europe/Amsterdam] PHP Fatal error: MySQLi Error: ( INSERT INTO [prefix]administrators (user, valid, date) VALUES ('loginname', '1', '2021-04-29 22:34:32') ) failed. MySQLi returned the error Duplicate entry '1-loginname' for key 'valid' in serverpath/zp-core/functions-db-MySQLi.php on line 95

zenphoto log

{1330:Thu, 29 Apr 2021 20:34:24 GMT} Zenphoto v1.5.7
USER ERROR: MySQLi Error: ( INSERT INTO [prefix]administrators (user, valid, date) VALUES ('loginname', '1', '2021-04-29 22:34:24') ) failed. MySQLi returned the error Duplicate entry '1-loginname' for key 'valid' in serverpath/zp-core/functions-db-MySQLi.php on line 95
trigger_error called from query (functions-db-MySQLi.php [95])
from PersistentObject->save (class-persistentobject.php [352])
from Zenphoto_Administrator->save (lib-auth.php [1625])
from PersistentObject->load (class-persistentobject.php [302])
from PersistentObject->instantiate (class-persistentobject.php [86])
from Zenphoto_Administrator->__construct (lib-auth.php [1363])
from Zenphoto_Authority->getMasterUser (lib-auth.php [97])
from security_logger::Logger (security-logger.php [112])
from security_logger::adminCookie (security-logger.php [352])
from zp_apply_filter (functions-filter.php [150])
from Zenphoto_Authority->checkCookieCredentials (lib-auth.php [807])
from require_once (auth_zp.php [69])
from require_once (load_objectClasses.php [42])
from require_once (functions.php [34])
from require_once (admin-functions.php [9])
from require_once (admin-globals.php [15])
from admin-logs.php [8]
{1353:Thu, 29 Apr 2021 20:34:32 GMT}
The error goes on but due to a character limit on the discussion form I cant post it

I thought Zenphoto was compatible with php7.2 so what is causing the error?

Greetings

Mark

Comments

  • acrylian Administrator, Developer

    Yes, it should be as we develop on PHP 7 for a while although we work on 7.4. Sadly have no idea.

    The issue is actually a MySQL issue as somehow there is someting inserted incorrectly. Please try 1.5.8RC (support build)

  • So, what is going on here is that the security logger is trying to find the language of the site by instantiation the master user. It does this so that the logs will be in the "owner" native language rather than the language of whoever caused the log entry to happen.

    Somehow in the process of instantiating the master user it failed to find him in the database. (Not sure how that could happen but it is always possible a bug in PHP caused something not to work correctly.) The instantiation call did not prohibit creating a new user of the same name, so that was tried. But then when the user was added to the database a duplicate entry was detected, so the attempt failed with the error message you show.)

    These things have not changed in ages, so the only practical assumption is that something in your PHP 7.2 installation caused the problem. PHP 7.2 (and PHP 7.1) are past end of life, so you really should be attempting to go to PHP 7.4 or at least PHP 7.3 which is supported until December this year.

    If you cannot make these moves, stick with what works.

  • I didn't want to go any higher than 7.2 because I have no idea of what the current most supported version of PHP is. But after your answers I tried PHP 7.4 and the site stayed up. It doesn't work with PHP 8 apparently because then it disappears again. but now I can install other software that needs a higher version of PHP. That was really the point of my question.

    Thanks

  • acrylian Administrator, Developer

    No, it does not work with PHP 8 yet and even 1.5.8 to be released soon will not yet. That will follow with the next update as we don't have time to really test this right now.

Sign In or Register to comment.