Error: Invalid security token, please reload the page and try again

Hello guys.
i setup phplist, latest version v3.6.8 on my VPS server, using PHP 8.0.
I connected a brand new database to it with full access on the same server. Setup the database parameters in the config.php file, and then initialized the database as per the setup instructions.

The rest of the software is in vanilla state as it comes zipped from the phplist .org download page.

I am constantly getting this error message when i try to add new test subscribers.
These are the steps i am making:

from the search subscriber page

  1. Add Subscriber button
  2. Type new email address > continue
  3. Edit subscriber profile > (set subscriber confirmed to 1) > click save changes
  4. Click the “Lists” tab > Check Newsletter and Test checkboxes > Click save changes
  5. Get error message “Error: Invalid security token, please reload the page and try again”

If i log out, and log back in, i try to add a new subscriber, i already added 8 test emails. The error message pops inconsistently, meaning sometimes i can add a new email and do not get the error.
But i also noticed another problem:
When i open the search subscibers page, i see for example 6 emails instead of the 8 i added, and clicking the find a subscriber “go” button, makes the missing ones show up.
I just tested login out and back in, and i see the 8 emails on the list.

I am testing on 2 different web browsers, and incognito windows, disabling the ad blocking extensions, and the cache on the server is setup to the minimum 2 seconds available option in cPanel.

I also have a new account on phplist.com and i am replicating the exact same steps, and everything works normally there without any error messages using the same web browsers, so the problem must be something in the setup itself or anything i haven’t configured yet?

Screenshots:

err2

Thanks for any tips

@axmail Do you get the same error on other pages? Try going to the Settings page and changing any of the fields.

Thank you duncanc for your help.

I am testing something different now.
I go to the Manage campaign templates section,

On web browser 1 (Brave) >
I create a new template, set a name for it (test x) add some text to the body and the required [CONTENT] tag, then i click save template.
I get a message: Images stored
Template saved and ready for use in campaigns
Then the template i just created does not show up at all, i see only the first template i created with some html code i copied the first time. Then i click on a different link like campaigns, and then go back to the Manage campaign templates, and the list is completely empty, there are no templates at all. I created like 6 already.

On web browser 2 (Firefox):
The first time i login i can actually see the list of test templates i created in Brave, but if i create a new template here, as soon as i click SAVE, the error is random.

  1. I get redirected to the login page and need to login to the platform again. or
  2. It shows me the list of templates with just the very first test i created, and if i refresh the page again, the list is now completely empty like no templates were ever created.

Another test on a different section.
I created a new administrator user under Config>Manage administrators. I set the options for the new user and saved the settings and got no errors, but then again, it does not show up on the list, i can only see the main ADMIN user i am using. If i refresh the page holding the shift key it makes no difference. But if i log out, and log back in again, i can see the new user i created.

I can keep looking for problems but i think this is more than enough.

Any idea what may be the issue?
I checked more information on my server:
Using 10.3.36-MariaDB

THEN… i found out this site is actually using PHP 7.4 instead of 8.
I switched to PHP 8 and 8.1 to see if it makes any difference, and it does. The site does not even load and i see just a white empty page. I guess the database is already tied to PHP 7.4?
I can recreate a new database under any of the newer php versions and point the software to the new database to test if it makes any difference.

I went full bananas and dropped the database (erased all its contents).
Then i replaced the lists folder with a fresh new installation from the zip file (3.6.8)
Then i tested… PHP 8 does not work. and PHP 8.1 the same… just shows a blank page if try to open the login page.
So i am stuck on php 7.4.
Right now i have the software in virgin state, connected to the blank database and ready to initialize it from scratch. I will run the same tests now and report if i get the same issues.

@axmail Possibly a problem with the php session. Do you know whether there were any changes to the phplist config in that area?
Can you find a php error log, that might have something in it.

There are still some problems with php 8, certainly php 8.1.

Ok SOLVED!!.. i hope

I setup this under a subdomain Ex: (phplist.mydomain.com) and i did not pay attention when setting up the cache to 2 seconds, i did it for the actual domain, but the subdomain has its own section which was still set at 4 hours in cPanel.
So i set the cache to 2 seconds for the phplist subdomain (i pointed a subdomain to a separate folder containing the LISTS folder with the install, i did not want to put it on the actual root of the domain yet until i test enough, i hope this wont affect other functions), then purged the cache for this subdomain and all the domains on my server.

I started all over from scratch, with the blank database, and PHP 8 and PHP8.1 actually work.
So my guess is php 7.4 was an issue and i was fighting with whatever was left on the server’s cache…

I initialized the blank database, and now i have the setup under PHP 8.1, and so far it runs like butter. I am able to add new subscribers and they show on the main list right away without any glitches, and i am also able to create new templates and they show up available without any problems.

I haven’t configured the SMTP settings yet, i will check all the functions and options in the menues as i am absolutely new to this program, and then setup the email configuration and run some tests emailing.

So @duncanc you recommend I downgrade to PHP 8 instead of using 8.1? I can switch versions back and forth with one click, no prob.

Thank you and sorry for the unnecessary long posts while i was troubleshooting.

@axmail Actually my CPanel installation of phplist runs fine with php 8.1 but I have had problems on my local machine. Possibly the level of error reporting might make a difference.